Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@burstjs/contracts
Advanced tools
Generic HTTP client that is used as a network provider for @burst/core.
@burstjs/contracts
can be used with NodeJS or Web. Two formats are available
Install using npm:
npm install @burstjs/contracts
or using yarn:
yarn add @burstjs/contracts
// TO DO
<script>
Each package is available as bundled standalone library using IIFE.
This way burstJS can be used also within <script>
-Tags.
This might be useful for Wordpress and/or other PHP applications.
Just import the package using the HTML <script>
tag.
<script src='https://cdn.jsdelivr.net/npm/@burstjs/http/dist/burstjs.http.min.js'></script>
// TO DO
See more here:
@burstjs/contracts Online Documentation
Generic Http client
HttpError class
Thrown on HTTP errors
Kind: inner class of http
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: inner class of http
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
Http Response
Returned by Http request
Kind: inner class of http
HttpError class
Thrown on HTTP errors
Kind: inner class of http
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: inner class of http
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
Http Response
Returned by Http request
Kind: inner class of http
HttpError class
Thrown on HTTP errors
Kind: inner class of http
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: inner class of http
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
Http Response
Returned by Http request
Kind: inner class of http
Generic Http client
Creates your Http client
Param | Description |
---|---|
baseURL | The baseUrl, i.e host url |
options | [optional] An options/configurations object applied to all requests The current implementation uses axios, so the options can be found here Axios Configuration |
FAQs
Smart Contracts package for BURST
The npm package @burstjs/contracts receives a total of 0 weekly downloads. As such, @burstjs/contracts popularity was classified as not popular.
We found that @burstjs/contracts 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.