Socket
Socket
Sign inDemoInstall

follow-redirects

Package Overview
Dependencies
Maintainers
3
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

follow-redirects - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

LICENSE

19

index.js

@@ -76,3 +76,3 @@ 'use strict';

// (The first request must be ended explicitly with RedirectableRequest#end)
if (this._currentResponse) {
if (this._isRedirect) {
// If the request doesn't have en entity, end directly.

@@ -121,2 +121,4 @@ var bufferedWrites = this._bufferedWrites;

// if it performs an automatic redirection to that URI.
var header;
var headers = this._options.headers;
if (response.statusCode !== 307 && !(this._options.method in safeMethods)) {

@@ -126,5 +128,5 @@ this._options.method = 'GET';

this._bufferedWrites = [];
for (var header in this._options.headers) {
for (header in headers) {
if (/^content-/i.test(header)) {
delete this._options.headers[header];
delete headers[header];
}

@@ -134,2 +136,11 @@ }

// Drop the Host header, as the redirect might lead to a different host
if (!this._isRedirect) {
for (header in headers) {
if (/^host$/i.test(header)) {
delete headers[header];
}
}
}
// Perform the redirected request

@@ -139,3 +150,3 @@ var redirectUrl = url.resolve(this._currentUrl, location);

Object.assign(this._options, url.parse(redirectUrl));
this._currentResponse = response;
this._isRedirect = true;
this._performRequest();

@@ -142,0 +153,0 @@ } else {

{
"name": "follow-redirects",
"version": "1.2.1",
"version": "1.2.2",
"description": "HTTP and HTTPS modules that follow redirects.",

@@ -5,0 +5,0 @@ "main": "index.js",

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