Socket
Socket
Sign inDemoInstall

postman-request

Package Overview
Dependencies
Maintainers
3
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postman-request - npm Package Compare versions

Comparing version 2.88.1-postman.30 to 2.88.1-postman.31

27

lib/redirect.js

@@ -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",

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