1 | # http-transport
|
2 |
|
3 | > A flexible, modular REST client built for ease-of-use and resilience
|
4 |
|
5 | ## Installation
|
6 |
|
7 | ```
|
8 | npm install @bbc/http-transport --save
|
9 | ```
|
10 |
|
11 | ## Usage
|
12 |
|
13 | ```js
|
14 | const url = 'http://example.com/';
|
15 | const client = require('@bbc/http-transport').createClient();
|
16 |
|
17 | const res = await client
|
18 | .get(url)
|
19 | .asResponse();
|
20 |
|
21 | if (res.statusCode === 200) {
|
22 | console.log(res.body);
|
23 | }
|
24 | ```
|
25 |
|
26 | ## Documentation
|
27 | For more examples and API details, see [API documentation](https://bbc.github.io/http-transport)
|
28 |
|
29 | ## Test
|
30 |
|
31 | ```
|
32 | npm test
|
33 | ```
|
34 |
|
35 | To generate a test coverage report:
|
36 |
|
37 | ```
|
38 | npm run coverage
|
39 | ```
|