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

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.0 to 1.2.1

25

index.js

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

for (var event in eventHandlers) {
/* istanbul ignore else */
if (event) {

@@ -77,8 +78,7 @@ request.on(event, eventHandlers[event]);

if (this._currentResponse) {
// If no body was written to the original request, or the method was changed to GET,
// end the redirected request (without writing a body).
// If the request doesn't have en entity, end directly.
var bufferedWrites = this._bufferedWrites;
if (bufferedWrites.length === 0 || this._options.method === 'GET') {
if (bufferedWrites.length === 0) {
request.end();
// The body of the original request must be added to the redirected request.
// Otherwise, write the request entity and end afterwards.
} else {

@@ -115,2 +115,5 @@ var i = 0;

// RFC7231§6.4: Automatic redirection needs to done with
// care for methods not known to be safe […],
// since the user might not wish to redirect an unsafe request.
// RFC7231§6.4.7: The 307 (Temporary Redirect) status code indicates

@@ -120,8 +123,10 @@ // that the target resource resides temporarily under a different URI

// if it performs an automatic redirection to that URI.
if (response.statusCode !== 307) {
// RFC7231§6.4: Automatic redirection needs to done with
// care for methods not known to be safe […],
// since the user might not wish to redirect an unsafe request.
if (!(this._options.method in safeMethods)) {
this._options.method = 'GET';
if (response.statusCode !== 307 && !(this._options.method in safeMethods)) {
this._options.method = 'GET';
// Drop a possible entity and headers related to it
this._bufferedWrites = [];
for (var header in this._options.headers) {
if (/^content-/i.test(header)) {
delete this._options.headers[header];
}
}

@@ -128,0 +133,0 @@ }

12

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

@@ -42,3 +42,3 @@ "main": "index.js",

"dependencies": {
"debug": "^2.2.0"
"debug": "^2.4.5"
},

@@ -48,7 +48,7 @@ "devDependencies": {

"concat-stream": "^1.5.0",
"coveralls": "^2.11.2",
"coveralls": "^2.11.15",
"express": "^4.13.0",
"mocha": "^3.1.2",
"nyc": "^8.3.1",
"xo": "^0.17.0"
"mocha": "^3.2.0",
"nyc": "^10.0.0",
"xo": "^0.17.1"
},

@@ -55,0 +55,0 @@ "license": "MIT",

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