Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

axios-retry

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-retry - npm Package Compare versions

Comparing version 3.1.0 to 3.1.1

31

es/index.js

@@ -10,6 +10,8 @@ import isRetryAllowed from 'is-retry-allowed';

export function isNetworkError(error) {
return !error.response
&& Boolean(error.code) // Prevents retrying cancelled requests
&& error.code !== 'ECONNABORTED' // Prevents retrying timed out requests
&& isRetryAllowed(error); // Prevents retrying unsafe errors
return (
!error.response &&
Boolean(error.code) && // Prevents retrying cancelled requests
error.code !== 'ECONNABORTED' && // Prevents retrying timed out requests
isRetryAllowed(error)
); // Prevents retrying unsafe errors
}

@@ -25,4 +27,6 @@

export function isRetryableError(error) {
return error.code !== 'ECONNABORTED'
&& (!error.response || (error.response.status >= 500 && error.response.status <= 599));
return (
error.code !== 'ECONNABORTED' &&
(!error.response || (error.response.status >= 500 && error.response.status <= 599))
);
}

@@ -172,3 +176,3 @@

export default function axiosRetry(axios, defaultOptions) {
axios.interceptors.request.use((config) => {
axios.interceptors.request.use(config => {
const currentState = getCurrentState(config);

@@ -196,7 +200,6 @@ currentState.lastRequestTime = Date.now();

const shouldRetry = retryCondition(error)
&& currentState.retryCount < retries;
const shouldRetry = retryCondition(error) && currentState.retryCount < retries;
if (shouldRetry) {
currentState.retryCount++;
currentState.retryCount += 1;
const delay = retryDelay(currentState.retryCount, error);

@@ -211,8 +214,8 @@

// Minimum 1ms timeout (passing 0 or less to XHR means no timeout)
config.timeout = Math.max((config.timeout - lastRequestDuration) - delay, 1);
config.timeout = Math.max(config.timeout - lastRequestDuration - delay, 1);
}
return new Promise((resolve) =>
setTimeout(() => resolve(axios(config)), delay)
);
config.transformRequest = [data => data];
return new Promise(resolve => setTimeout(() => resolve(axios(config)), delay));
}

@@ -219,0 +222,0 @@

@@ -37,3 +37,3 @@ import * as axios from 'axios'

axiosRetryConfig?: IAxiosRetryConfig
)
): void
}

@@ -40,0 +40,0 @@

@@ -27,5 +27,5 @@ 'use strict';

function isNetworkError(error) {
return !error.response && Boolean(error.code) // Prevents retrying cancelled requests
&& error.code !== 'ECONNABORTED' // Prevents retrying timed out requests
&& (0, _isRetryAllowed2.default)(error); // Prevents retrying unsafe errors
return !error.response && Boolean(error.code) && // Prevents retrying cancelled requests
error.code !== 'ECONNABORTED' && // Prevents retrying timed out requests
(0, _isRetryAllowed2.default)(error); // Prevents retrying unsafe errors
}

@@ -217,3 +217,3 @@

if (shouldRetry) {
currentState.retryCount++;
currentState.retryCount += 1;
var delay = retryDelay(currentState.retryCount, error);

@@ -231,2 +231,6 @@

config.transformRequest = [function (data) {
return data;
}];
return new Promise(function (resolve) {

@@ -233,0 +237,0 @@ return setTimeout(function () {

{
"name": "axios-retry",
"version": "3.1.0",
"version": "3.1.1",
"author": "Rubén Norte <ruben.norte@softonic.com>",

@@ -24,4 +24,11 @@ "description": "Axios plugin that intercepts failed requests and retries them whenever posible.",

"postrelease": "npm run push && npm publish",
"push": "git push origin master && git push origin --tags"
"push": "git push origin master && git push origin --tags",
"precommit": "lint-staged"
},
"lint-staged": {
"*.+(js|jsx|scss)": [
"prettier --write",
"git add"
]
},
"dependencies": {

@@ -35,8 +42,13 @@ "is-retry-allowed": "^1.1.0"

"babel-register": "^6.9.0",
"eslint": "^2.13.1",
"eslint-config-airbnb-base": "^3.0.1",
"eslint-plugin-import": "^1.9.2",
"eslint": "^4.4.1",
"eslint-config-airbnb-base": "^11.3.1",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jasmine": "^1.8.1",
"eslint-plugin-prettier": "^2.6.0",
"husky": "^0.14.3",
"jasmine": "^2.4.1",
"nock": "^8.0.0"
"lint-staged": "^7.1.2",
"nock": "^8.0.0",
"prettier": "^1.12.1"
},

@@ -43,0 +55,0 @@ "repository": {

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