follow-redirects
Advanced tools
Comparing version 1.12.1 to 1.13.0
@@ -355,4 +355,5 @@ var url = require("url"); | ||
if (typeof this._options.beforeRedirect === "function") { | ||
var responseDetails = { headers: response.headers }; | ||
try { | ||
this._options.beforeRedirect.call(null, this._options); | ||
this._options.beforeRedirect.call(null, this._options, responseDetails); | ||
} | ||
@@ -359,0 +360,0 @@ catch (err) { |
{ | ||
"name": "follow-redirects", | ||
"version": "1.12.1", | ||
"version": "1.13.0", | ||
"description": "HTTP and HTTPS modules that follow redirects.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -31,3 +31,3 @@ ## Follow Redirects | ||
```javascript | ||
https.request({ | ||
const request = https.request({ | ||
host: 'bitly.com', | ||
@@ -39,2 +39,3 @@ path: '/UHfDGO', | ||
}); | ||
request.end(); | ||
``` | ||
@@ -67,4 +68,5 @@ | ||
options.maxRedirects = 10; | ||
options.beforeRedirect = options => { | ||
// Use this function to adjust the options upon redirecting, | ||
options.beforeRedirect = (options, { headers }) => { | ||
// Use this to adjust the request options upon redirecting, | ||
// to inspect the latest response headers, | ||
// or to cancel the request by throwing an error | ||
@@ -71,0 +73,0 @@ if (options.hostname === "example.com") { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24066
458
149