Socket
Socket
Sign inDemoInstall

get-it

Package Overview
Dependencies
Maintainers
1
Versions
159
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-it - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

2

lib/middleware/jsonResponse.js

@@ -9,3 +9,3 @@ 'use strict';

var contentType = response.headers['content-type'];
if (!response.body || contentType.indexOf('application/json') === -1) {
if (!response.body || !contentType || contentType.indexOf('application/json') === -1) {
return response;

@@ -12,0 +12,0 @@ }

@@ -11,3 +11,3 @@ 'use strict';

var retryDelay = opts.retryDelay || getRetryDelay;
var shouldRetry = opts.shouldRetry || defaultShouldRetry;
var allowRetry = opts.shouldRetry || defaultShouldRetry;

@@ -17,6 +17,8 @@ return {

var options = context.options;
var max = options.maxRetries || maxRetries;
var shouldRetry = options.shouldRetry || allowRetry;
var attemptNumber = options.attemptNumber || 0;
// Give up?
if (!shouldRetry(err, attemptNumber) || attemptNumber >= maxRetries) {
if (!shouldRetry(err, attemptNumber) || attemptNumber >= max) {
return err;

@@ -23,0 +25,0 @@ }

'use strict';
module.exports = require('is-retry-allowed');
var allowed = require('is-retry-allowed');
module.exports = function (err) {
// Don't allow retries if we get any http status code by default
if (err.response && err.response.statusCode) {
return false;
}
return allowed(err);
};
//# sourceMappingURL=node-shouldRetry.js.map
{
"name": "get-it",
"version": "0.0.6",
"version": "0.0.7",
"description": "Generic HTTP request library for node and browsers",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -6,3 +6,3 @@ const objectAssign = require('object-assign')

const contentType = response.headers['content-type']
if (!response.body || contentType.indexOf('application/json') === -1) {
if (!response.body || !contentType || contentType.indexOf('application/json') === -1) {
return response

@@ -9,0 +9,0 @@ }

@@ -7,3 +7,3 @@ const objectAssign = require('object-assign')

const retryDelay = opts.retryDelay || getRetryDelay
const shouldRetry = opts.shouldRetry || defaultShouldRetry
const allowRetry = opts.shouldRetry || defaultShouldRetry

@@ -13,6 +13,8 @@ return {

const options = context.options
const max = options.maxRetries || maxRetries
const shouldRetry = options.shouldRetry || allowRetry
const attemptNumber = options.attemptNumber || 0
// Give up?
if (!shouldRetry(err, attemptNumber) || attemptNumber >= maxRetries) {
if (!shouldRetry(err, attemptNumber) || attemptNumber >= max) {
return err

@@ -19,0 +21,0 @@ }

@@ -1,1 +0,10 @@

module.exports = require('is-retry-allowed')
const allowed = require('is-retry-allowed')
module.exports = err => {
// Don't allow retries if we get any http status code by default
if (err.response && err.response.statusCode) {
return false
}
return allowed(err)
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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