From 1e1f8fc2f5c1fb61b1db54614bed66623faf9e5d Mon Sep 17 00:00:00 2001 From: Dmitri Zagidulin Date: Thu, 10 Aug 2023 22:56:05 -0400 Subject: [PATCH] Add a react-native section to package.json. --- CHANGELOG.md | 3 +++ README.md | 13 +++++++++---- package.json | 3 +++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 850b798..0fbf517 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 0cef110..d19a1b8 100644 --- a/README.md +++ b/README.md @@ -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'; @@ -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 @@ -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 diff --git a/package.json b/package.json index 945e9cf..bc46cc5 100644 --- a/package.json +++ b/package.json @@ -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",