0.6.0-beta.6 • Published 3 years ago

@burstjs/http v0.6.0-beta.6

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
3 years ago

@burstjs/http

Generic HTTP client that is used as a network provider for @burst/core.

Installation

@burstjs/http can be used with NodeJS or Web. Two formats are available

Using with NodeJS and/or modern web frameworks

Install using npm:

npm install @burstjs/http

or using yarn:

yarn add @burstjs/http

Example

import {HttpImpl} from '@burstjs/http'

try{
    const client = new HttpImpl('https://jsonplaceholder.typicode.com/');
    const response = client.get('/todos/1')
    console.log(response)
}
catch(httpError){
    console.error(httpError.message)
}

Using in classic <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>

Example

const client = new b$http.HttpImpl('https://jsonplaceholder.typicode.com/');
client.get('/todos/1').then(console.log)

See more here:

@burstjs/http Online Documentation


API Reference

Modules

http

http~HttpImpl

Kind: inner class of http

new HttpImpl(baseURL, options)

ParamDescription
baseURLThe baseUrl, i.e host url
optionsoptional An options/configurations object applied to all requests The current implementation uses axios, so the options can be found here Axios Configuration

HttpImpl.mountError(url, error)

Kind: static method of HttpImpl
Internal:

ParamDescription
urlThe url
errorThe returned error

http

http~HttpImpl

Kind: inner class of http

new HttpImpl(baseURL, options)

ParamDescription
baseURLThe baseUrl, i.e host url
optionsoptional An options/configurations object applied to all requests The current implementation uses axios, so the options can be found here Axios Configuration

HttpImpl.mountError(url, error)

Kind: static method of HttpImpl
Internal:

ParamDescription
urlThe url
errorThe returned error

http

Internal: 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

http~HttpImpl

Kind: inner class of http

new HttpImpl(baseURL, options)

ParamDescription
baseURLThe baseUrl, i.e host url
optionsoptional An options/configurations object applied to all requests The current implementation uses axios, so the options can be found here Axios Configuration

HttpImpl.mountError(url, error)

Kind: static method of HttpImpl
Internal:

ParamDescription
urlThe url
errorThe returned error

http

const response = await mockedHttp.get('/url');

await mockedHttp.post('/url/post', {faz: 'post'}); // will throw exception

http~HttpImpl

Kind: inner class of http

new HttpImpl(baseURL, options)

ParamDescription
baseURLThe baseUrl, i.e host url
optionsoptional An options/configurations object applied to all requests The current implementation uses axios, so the options can be found here Axios Configuration

HttpImpl.mountError(url, error)

Kind: static method of HttpImpl
Internal:

ParamDescription
urlThe url
errorThe returned error

http

http~HttpImpl

Kind: inner class of http

new HttpImpl(baseURL, options)

ParamDescription
baseURLThe baseUrl, i.e host url
optionsoptional An options/configurations object applied to all requests The current implementation uses axios, so the options can be found here Axios Configuration

HttpImpl.mountError(url, error)

Kind: static method of HttpImpl
Internal:

ParamDescription
urlThe url
errorThe returned error

http

http~HttpImpl

Kind: inner class of http

new HttpImpl(baseURL, options)

ParamDescription
baseURLThe baseUrl, i.e host url
optionsoptional An options/configurations object applied to all requests The current implementation uses axios, so the options can be found here Axios Configuration

HttpImpl.mountError(url, error)

Kind: static method of HttpImpl
Internal:

ParamDescription
urlThe url
errorThe returned error
0.6.0-beta.6

3 years ago

0.6.0-beta.5

3 years ago

0.6.0-beta.4

3 years ago

0.6.0-beta.3

3 years ago

0.6.0-beta.2

3 years ago

0.6.0-beta.1

3 years ago

0.6.0-alpha.9

3 years ago

0.6.0-alpha.8

3 years ago

0.6.0-alpha.7

3 years ago

0.6.0-alpha.5

3 years ago

0.6.0-alpha.6

3 years ago

0.6.0-alpha.4

3 years ago

0.6.0-alpha.2

3 years ago

0.6.0-alpha.1

3 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.5.0-beta.12

4 years ago

0.5.0-beta.11

4 years ago

0.5.0-beta.10

4 years ago

0.5.0-beta.9

4 years ago

0.5.0-beta.8

4 years ago

0.5.0-beta.7

4 years ago

0.5.0-beta.6

4 years ago

0.5.0-beta.5

4 years ago

0.5.0-beta.4

4 years ago

0.5.0-beta.3

4 years ago

0.5.0-beta.2

4 years ago

0.5.0-beta.1

4 years ago

0.5.0-alpha.3

4 years ago

0.5.0-alpha.2

4 years ago

0.5.0-alpha.1

4 years ago

0.5.0-alpha.0

4 years ago

0.4.3

4 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0-rc.3.2

5 years ago

0.1.0-rc.3.1

5 years ago

0.1.0-rc.3

5 years ago

0.1.0-rc.2

5 years ago

0.1.0-rc1

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago