Socket
Socket
Sign inDemoInstall

@algolia/requester-node-http

Package Overview
Dependencies
Maintainers
60
Versions
229
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@algolia/requester-node-http - npm Package Compare versions

Comparing version 4.0.0-beta.10 to 4.0.0-beta.11

25

dist/requester-node-http.cjs.js

@@ -9,3 +9,7 @@ 'use strict';

/* eslint sonarjs/cognitive-complexity: 0 */ // -->
function createNodeHttpRequester() {
const agentOptions = { keepAlive: true };
const httpAgent = new http.Agent(agentOptions);
const httpsAgent = new https.Agent(agentOptions);
return {

@@ -17,4 +21,5 @@ send(request) {

const options = {
hostname: url.hostname || '',
path: path || '',
agent: url.protocol === 'https:' ? httpsAgent : httpAgent,
hostname: url.hostname,
path,
method: request.method,

@@ -33,4 +38,7 @@ headers: request.headers,

clearTimeout(responseTimeout);
const status = response.statusCode === undefined ? 0 : response.statusCode;
resolve({ status, content, isTimedOut: false });
resolve({
status: response.statusCode || 0,
content,
isTimedOut: false,
});
});

@@ -60,6 +68,13 @@ });

});
req.write(request.data);
if (request.data !== undefined) {
req.write(request.data);
}
req.end();
});
},
destroy() {
httpAgent.destroy();
httpsAgent.destroy();
return Promise.resolve();
},
};

@@ -66,0 +81,0 @@ }

3

dist/requester-node-http.d.ts

@@ -0,5 +1,6 @@

import { Destroyable } from '@algolia/requester-common';
import { Requester } from '@algolia/requester-common';
export declare function createNodeHttpRequester(): Requester;
export declare function createNodeHttpRequester(): Requester & Destroyable;
export { }
import * as http from 'http';
import { Agent } from 'http';
import * as https from 'https';
import { Agent as Agent$1 } from 'https';
import { parse } from 'url';
/* eslint sonarjs/cognitive-complexity: 0 */ // -->
function createNodeHttpRequester() {
const agentOptions = { keepAlive: true };
const httpAgent = new Agent(agentOptions);
const httpsAgent = new Agent$1(agentOptions);
return {

@@ -12,4 +18,5 @@ send(request) {

const options = {
hostname: url.hostname || '',
path: path || '',
agent: url.protocol === 'https:' ? httpsAgent : httpAgent,
hostname: url.hostname,
path,
method: request.method,

@@ -28,4 +35,7 @@ headers: request.headers,

clearTimeout(responseTimeout);
const status = response.statusCode === undefined ? 0 : response.statusCode;
resolve({ status, content, isTimedOut: false });
resolve({
status: response.statusCode || 0,
content,
isTimedOut: false,
});
});

@@ -55,6 +65,13 @@ });

});
req.write(request.data);
if (request.data !== undefined) {
req.write(request.data);
}
req.end();
});
},
destroy() {
httpAgent.destroy();
httpsAgent.destroy();
return Promise.resolve();
},
};

@@ -61,0 +78,0 @@ }

{
"name": "@algolia/requester-node-http",
"version": "4.0.0-beta.10",
"version": "4.0.0-beta.11",
"private": false,

@@ -16,4 +16,4 @@ "description": "Promise-based request library for node using the native http module.",

"dependencies": {
"@algolia/requester-common": "4.0.0-beta.10"
"@algolia/requester-common": "4.0.0-beta.11"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc