Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# @digitalbazaar/http-client ChangeLog

### Added
- Add a `"react-native"` override section to `package.json`.

## 4.0.0 - 2023-09-12

### Changed
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
# http-client
An opinionated, isomorphic HTTP client.
An opinionated, isomorphic HTTP client for Node.js, browsers, and React Native.

### Usage

#### Import httpClient
#### Import httpClient (Node.js)
```js
import https from 'https';
import {httpClient} from '@digitalbazaar/http-client';
```

#### Import httpClient (browsers or React Native)
```js
import {httpClient} from '@digitalbazaar/http-client';
```

#### Import and initialize a custom Bearer Token client
```js
import {httpClient} from '@digitalbazaar/http-client';
Expand Down Expand Up @@ -37,7 +42,7 @@ try {
}
```

#### GET a JSON response in Node with a HTTP Agent
#### GET a JSON response in Node with an HTTP Agent
```js
import https from 'https';
// use an agent to avoid self-signed certificate errors
Expand Down Expand Up @@ -84,7 +89,7 @@ try {
}
```

#### POST a JSON payload in Node with a HTTP Agent
#### POST a JSON payload in Node with an HTTP Agent
```js
import https from 'https';
// use an agent to avoid self-signed certificate errors
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"./lib/agentCompatibility.js": "./lib/agentCompatibility-browser.js",
"./tests/utils.cjs": "./tests/utils-browser.cjs"
},
"react-native": {
"./lib/agentCompatibility.js": "./lib/agentCompatibility-browser.js"
},
"scripts": {
"rollup": "rollup -c rollup.config.js",
"build": "npm run clear && npm run rollup",
Expand Down