Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@burstjs/http
Advanced tools
Generic HTTP client that is used as a network provider for @burst/core.
Install using npm:
npm install @burstjs/http
or using yarn:
yarn add @burstjs/http
HttpError class
Thrown on HTTP errors
Http Mocker for easy to http testing using Jest
When using this mocking helper you need to call Http.onGet()
before Http instance is created
HttpError class
Thrown on HTTP errors
Creates your Http client
Param | Description |
---|---|
baseURL | The baseUrl, i.e host url |
Http Mocker for easy to http testing using Jest
When using this mocking helper you need to call Http.onGet()
before Http instance is created
Kind: global class
Mocks responses for get methods You may pass a specific endpoint as parameter to mock only selected endpoints. This is very useful, when having methods that do several Http requests, so you can mock them one on one.
The following code returns the same content on every get call
HttpMock.onGet().reply(200, [{login: 'foo'}, {login: 'bar'}]);
The next code returns the different content depending on the passed endpoint
HttpMock.onGet('/foo').reply(200, {data: 'foo'});
HttpMock.onGet('/bar').reply(200, {data: 'bar'});
Kind: static method of HttpMock
Param | Description |
---|---|
endpoint? | An endpoint, to allow specific behavior on that endpoint |
Mocks responses for post methods
Kind: static method of HttpMock
Param | Description |
---|---|
endpoint? | An endpoint, to allow specific behavior on that endpoint |
Mocks responses for put methods
Kind: static method of HttpMock
Param | Description |
---|---|
endpoint? | An endpoint, to allow specific behavior on that endpoint |
Mocks responses for delete methods
Kind: static method of HttpMock
Param | Description |
---|---|
endpoint? | An endpoint, to allow specific behavior on that endpoint |
Resets all mocked behavior
Kind: static method of HttpMock
FAQs
Send commands to BURST over HTTP
The npm package @burstjs/http receives a total of 3 weekly downloads. As such, @burstjs/http popularity was classified as not popular.
We found that @burstjs/http demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.