Socket
Socket
Sign inDemoInstall

reqlib

Package Overview
Dependencies
3
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.2

19

dist/index.js

@@ -254,3 +254,3 @@ "use strict";

state.data = data || '';
state.redirects = state.redirects || 0;
state.redirects = state.redirects || [];
state.tries = state.tries || 1; // serialize any provided data

@@ -310,3 +310,3 @@

if (redirect) {
if (isEmpty(state.headers[HTTP_HEADERS.LOCATION])) {
if (!headerExists(state.headers, HTTP_HEADERS.LOCATION)) {
var _err = new Error('redirect requested with no location');

@@ -319,3 +319,3 @@

if (state.redirects >= options.maxRedirectCount) {
if (state.redirects.length >= options.maxRedirectCount) {
var _err2 = new Error('maximum redirect limit exceeded');

@@ -326,10 +326,17 @@

return reject(_err2);
} // remap options and redirect to supplied URL
} // read location from headers
var redirectUrl = _url.default.parse(state.headers[HTTP_HEADERS.LOCATION]);
var redirectUrl = _url.default.parse(coalesce(response.headers[HTTP_HEADERS.LOCATION], response.headers[HTTP_HEADERS.LOCATION.toLowerCase()])); // set protocol when missing (i.e. location begins with '//' instead of protocol)
if (isEmpty(redirectUrl.protocol) && state.redirects.length) {
var previousRedirect = state.redirects[state.redirects.length - 1];
redirectUrl = _url.default.parse([previousRedirect.protocol, redirectUrl.href].join(''));
} // remap options for next request
(0, _assign.default)(options, redirectUrl); // increment number of redirects (to avoid endless looping)
state.redirects++; // emit redirect event
state.redirects.push(redirectUrl); // emit redirect event

@@ -336,0 +343,0 @@ self.emit(EVENTS.redirect, {

@@ -0,1 +1,6 @@

# v1.0.2 - 02/13/2019
* Added more unit tests
* Fixed issue where redirects fail when location header value begins with '//' instead of protocol
# v1.0.1 - 02/13/2019

@@ -2,0 +7,0 @@

{
"name": "reqlib",
"version": "1.0.1",
"version": "1.0.2",
"description": "A library to simplify REST API requests and to provide utilities for handling common REST API consumer scenarios ",

@@ -5,0 +5,0 @@ "main": "dist",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc