🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@digitalbazaar/http-client

Package Overview
Dependencies
Maintainers
4
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@digitalbazaar/http-client - npm Package Compare versions

Comparing version
4.2.0
to
4.3.0
+1
-2
dist/cjs/index.cjs

@@ -53,3 +53,2 @@ 'use strict';

args[1] = {...args[1], dispatcher};
// eslint-disable-next-line no-undef
return globalThis.fetch(...args);

@@ -74,3 +73,3 @@ };

);
},
}
};

@@ -77,0 +76,0 @@ }

@@ -50,5 +50,4 @@ /*!

args[1] = {...args[1], dispatcher};
// eslint-disable-next-line no-undef
return globalThis.fetch(...args);
};
}

@@ -16,4 +16,4 @@ export function deferred(f) {

);
},
}
};
}
{
"name": "@digitalbazaar/http-client",
"version": "4.2.0",
"version": "4.3.0",
"description": "An opinionated, isomorphic HTTP client.",

@@ -33,3 +33,3 @@ "license": "BSD-3-Clause",

"coverage-report": "c8 report",
"lint": "eslint --ext .cjs,.js --ignore-pattern rollup.config.js ."
"lint": "eslint"
},

@@ -41,16 +41,14 @@ "files": [

"dependencies": {
"ky": "^1.7.5",
"undici": "^6.21.2"
"ky": "^1.14.2",
"undici": "^6.23.0"
},
"devDependencies": {
"@digitalbazaar/eslint-config": "^7.0.0",
"c8": "^10.1.3",
"chai": "^4.5.0",
"cors": "^2.8.5",
"cross-env": "^7.0.3",
"cross-env": "^10.1.0",
"detect-node": "^2.1.0",
"eslint": "^8.57.1",
"eslint-config-digitalbazaar": "^5.2.0",
"eslint-plugin-jsdoc": "^50.6.9",
"eslint-plugin-unicorn": "^56.0.1",
"express": "^4.21.2",
"eslint": "^9.39.2",
"express": "^5.2.1",
"karma": "^6.4.4",

@@ -63,6 +61,6 @@ "karma-chai": "^0.1.0",

"karma-webpack": "^5.0.1",
"mocha": "^11.1.0",
"rimraf": "^6.0.1",
"rollup": "^4.37.0",
"webpack": "^5.98.0"
"mocha": "^11.7.5",
"rimraf": "^6.1.2",
"rollup": "^4.55.1",
"webpack": "^5.104.1"
},

@@ -69,0 +67,0 @@ "repository": {

+14
-12

@@ -6,13 +6,7 @@ # http-client

#### Import httpClient (Node.js)
#### Import httpClient (Node.js, browsers, or React Native)
```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

@@ -22,13 +16,21 @@ ```js

const httpsAgent = new https.Agent({rejectUnauthorized: false});
const accessToken = '12345';
const headers = {Authorization: `Bearer ${accessToken}`};
const client = httpClient.extend({headers, httpsAgent});
const client = httpClient.extend({headers});
// subsequent http calls will include an 'Authorization: Bearer 12345' header,
// and use the provided httpsAgent
// subsequent http calls will include an 'Authorization: Bearer 12345' header
```
#### Disable self-signed TLS/SSL cert checks for development purposes only
```js
import {Agent} from 'https';
import {httpClient} from '@digitalbazaar/http-client';
const agent = new https.Agent({rejectUnauthorized: false});
const client = httpClient.extend({headers, agent});
// subsequent http calls will use the provided https Agent
```
#### GET a JSON response in the browser

@@ -35,0 +37,0 @@ ```js