@algolia/requester-node-http 5.0.0-alpha.73 → 5.0.0-alpha.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,25 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var url = require('url');
|
|
6
4
|
var clientCommon = require('@algolia/client-common');
|
|
7
5
|
var http = require('http');
|
|
8
6
|
var https = require('https');
|
|
9
7
|
|
|
10
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
-
|
|
12
|
-
var http__default = /*#__PURE__*/_interopDefaultLegacy(http);
|
|
13
|
-
var https__default = /*#__PURE__*/_interopDefaultLegacy(https);
|
|
14
|
-
|
|
15
8
|
function echoRequester(status = 200) {
|
|
16
9
|
return clientCommon.createEchoRequester({ getURL: (url$1) => new url.URL(url$1), status });
|
|
17
10
|
}
|
|
18
11
|
|
|
19
12
|
// Global agents allow us to reuse the TCP protocol with multiple clients
|
|
20
13
|
const agentOptions = { keepAlive: true };
|
|
21
|
-
const defaultHttpAgent = new
|
|
22
|
-
const defaultHttpsAgent = new
|
|
14
|
+
const defaultHttpAgent = new http.Agent(agentOptions);
|
|
15
|
+
const defaultHttpsAgent = new https.Agent(agentOptions);
|
|
23
16
|
function createHttpRequester({ agent: userGlobalAgent, httpAgent: userHttpAgent, httpsAgent: userHttpsAgent, requesterOptions = {}, } = {}) {
|
|
24
17
|
const httpAgent = userHttpAgent || userGlobalAgent || defaultHttpAgent;
|
|
25
18
|
const httpsAgent = userHttpsAgent || userGlobalAgent || defaultHttpsAgent;
|
|
@@ -44,7 +37,7 @@ function createHttpRequester({ agent: userGlobalAgent, httpAgent: userHttpAgent,
|
|
|
44
37
|
if (url$1.port && !requesterOptions.port) {
|
|
45
38
|
options.port = url$1.port;
|
|
46
39
|
}
|
|
47
|
-
const req = (url$1.protocol === 'https:' ?
|
|
40
|
+
const req = (url$1.protocol === 'https:' ? https : http).request(options, (response) => {
|
|
48
41
|
let contentBuffers = [];
|
|
49
42
|
response.on('data', (chunk) => {
|
|
50
43
|
contentBuffers = contentBuffers.concat(chunk);
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@algolia/requester-node-http",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.76",
|
|
4
4
|
"description": "Promise-based request library for node using the native http module.",
|
|
5
5
|
"repository": "algolia/algoliasearch-client-javascript",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Algolia",
|
|
8
|
+
"type": "module",
|
|
8
9
|
"main": "dist/requester-node-http.cjs.js",
|
|
9
10
|
"module": "dist/requester-node-http.esm.node.js",
|
|
10
11
|
"types": "dist/index.d.ts",
|
|
@@ -19,15 +20,15 @@
|
|
|
19
20
|
"test": "jest"
|
|
20
21
|
},
|
|
21
22
|
"dependencies": {
|
|
22
|
-
"@algolia/client-common": "5.0.0-alpha.
|
|
23
|
+
"@algolia/client-common": "5.0.0-alpha.76"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
|
-
"@types/jest": "29.5.
|
|
26
|
-
"@types/node": "18.
|
|
27
|
-
"jest": "29.
|
|
28
|
-
"nock": "13.3.
|
|
29
|
-
"ts-jest": "29.1.
|
|
30
|
-
"typescript": "5.
|
|
26
|
+
"@types/jest": "29.5.3",
|
|
27
|
+
"@types/node": "18.17.0",
|
|
28
|
+
"jest": "29.6.1",
|
|
29
|
+
"nock": "13.3.2",
|
|
30
|
+
"ts-jest": "29.1.1",
|
|
31
|
+
"typescript": "5.1.6"
|
|
31
32
|
},
|
|
32
33
|
"engines": {
|
|
33
34
|
"node": ">= 14.0.0"
|