Skip to content

Commit 6bf0120

Browse files
authored
Update README.md.
1 parent a839812 commit 6bf0120

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,32 @@ An opinionated, isomorphic HTTP client for Node.js, browsers, and React Native.
33

44
### Usage
55

6-
#### Import httpClient (Node.js)
6+
#### Import httpClient (Node.js, browsers, or React Native)
77
```js
8-
import https from 'https';
98
import {httpClient} from '@digitalbazaar/http-client';
109
```
1110

12-
#### Import httpClient (browsers or React Native)
11+
#### Import and initialize a custom Bearer Token client
1312
```js
1413
import {httpClient} from '@digitalbazaar/http-client';
14+
15+
const accessToken = '12345';
16+
const headers = {Authorization: `Bearer ${accessToken}`};
17+
18+
const client = httpClient.extend({headers});
19+
20+
// subsequent http calls will include an 'Authorization: Bearer 12345' header
1521
```
1622

17-
#### Import and initialize a custom Bearer Token client
23+
#### Disable self-signed TLS/SSL cert checks for development purposes only
1824
```js
25+
import {Agent} from 'https';
1926
import {httpClient} from '@digitalbazaar/http-client';
2027

2128
const httpsAgent = new https.Agent({rejectUnauthorized: false});
22-
23-
const accessToken = '12345';
24-
const headers = {Authorization: `Bearer ${accessToken}`};
25-
2629
const client = httpClient.extend({headers, httpsAgent});
2730

28-
// subsequent http calls will include an 'Authorization: Bearer 12345' header,
29-
// and use the provided httpsAgent
31+
// subsequent http calls will use the provided httpsAgent
3032
```
3133

3234
#### GET a JSON response in the browser

0 commit comments

Comments
 (0)