Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

http-basic

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-basic - npm Package Compare versions

Comparing version 2.3.1 to 2.3.2

32

index.js

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

function request(method, url, options, callback) {
var start = Date.now();
if (typeof method !== 'string') {

@@ -112,10 +113,15 @@ throw new TypeError('The method must be a string.');

}
var opts = {};
Object.keys(options).forEach(function (key) {
opts[key] = options[key];
});
options = opts;
if (options.maxRedirects && options.maxRedirects !== Infinity) {
var opts = {};
Object.keys(options).forEach(function (key) {
opts[key] = options[key];
});
options = opts;
options.maxRedirects--;
}
// don't maintain headers through redirects
// This fixes a problem where a POST to http://example.com
// might result in a GET to http://example.co.uk that includes "content-length"
// as a header
options.headers = {};
return request(duplex ? 'GET' : method, resolveUrl(urlString, res.headers.location), options, callback);

@@ -184,7 +190,7 @@ } else {

function attempt(n) {
console.dir('attempt: ' + n);
request(method, urlString, {
headers: headers,
agent: agent,
timeout: options.timeout,
socketTimeout: options.socketTimeout
timeout: options.timeout
}, function (err, res) {

@@ -218,2 +224,11 @@ var retry = err || res.statusCode >= 400;

console.log(method + ' ' + urlString);
console.dir({
host: url.hostname,
port: url.port,
path: url.path,
method: method,
headers: headers,
agent: agent
});
var req = protocols[url.protocol.replace(/\:$/, '')].request({

@@ -227,2 +242,5 @@ host: url.hostname,

}, function (res) {
var end = Date.now();
console.log(method + ' ' + urlString + ' (' + res.statusCode + ') - ' + (end - start) + 'ms');
console.dir(res.headers, {colors: true});
if (responded) return res.resume();

@@ -229,0 +247,0 @@ responded = true;

{
"name": "http-basic",
"version": "2.3.1",
"version": "2.3.2",
"description": "Very low level wrapper arround http.request/https.request",

@@ -5,0 +5,0 @@ "keywords": [

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