postman-request
Advanced tools
Comparing version 2.88.1-postman.30 to 2.88.1-postman.31
@@ -144,11 +144,13 @@ 'use strict' | ||
// if statusCode code is 401, 307 or 308: | ||
// 1. Switch request method to GET if followOriginalHttpMethod is not set | ||
// 2. Remove request body on redirect | ||
if (response.statusCode !== 401 && response.statusCode !== 307 && response.statusCode !== 308) { | ||
// force all redirects to use GET (due to legacy shenanigans) | ||
// use followOriginalHttpMethod option to avoid this | ||
// @todo: figure out why its only done for HEAD method and not for similar | ||
// request methods like OPTIONS or CONNECT. | ||
if (!self.followOriginalHttpMethod && request.method !== 'HEAD') { | ||
// Switch request method to GET | ||
// - if followOriginalHttpMethod is not set [OVERRIDE] | ||
// - or, statusCode code is not 401, 307 or 308 [STANDARD] | ||
// - also, remove request body for the GET redirect [STANDARD] | ||
// @note: when followOriginalHttpMethod is set, | ||
// it will always retain the request body irrespective of the method (say GET) or status code (any 3XX). | ||
if (!self.followOriginalHttpMethod && | ||
response.statusCode !== 401 && response.statusCode !== 307 && response.statusCode !== 308) { | ||
// force all redirects to use GET (legacy reasons) | ||
// but, HEAD is considered as a safe method so, the method is retained. | ||
if (request.method !== 'HEAD') { | ||
request.method = 'GET' | ||
@@ -161,8 +163,11 @@ } | ||
delete request._form | ||
delete request._multipart | ||
if (request.headers) { | ||
request.removeHeader('host') | ||
request.removeHeader('content-type') | ||
request.removeHeader('content-length') | ||
} | ||
} else if (request.formData && | ||
} | ||
// Restore form-data stream if request body is retained | ||
if (request.formData && | ||
// make sure _form is released and there's no pending _streams left | ||
@@ -169,0 +174,0 @@ // which will be the case for 401 redirects. so, reuse _form on redirect |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "2.88.1-postman.30", | ||
"version": "2.88.1-postman.31", | ||
"repository": { | ||
@@ -13,0 +13,0 @@ "type": "git", |
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
244113
3289