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