axios-retry
Advanced tools
Comparing version 4.4.1 to 4.4.2
@@ -102,6 +102,8 @@ "use strict"; | ||
} | ||
function setCurrentState(config, defaultOptions) { | ||
function setCurrentState(config, defaultOptions, resetLastRequestTime = false) { | ||
const currentState = getRequestOptions(config, defaultOptions || {}); | ||
currentState.retryCount = currentState.retryCount || 0; | ||
currentState.lastRequestTime = currentState.lastRequestTime || Date.now(); | ||
if (!currentState.lastRequestTime || resetLastRequestTime) { | ||
currentState.lastRequestTime = Date.now(); | ||
} | ||
config[exports.namespace] = currentState; | ||
@@ -191,3 +193,3 @@ return currentState; | ||
var _a; | ||
setCurrentState(config, defaultOptions); | ||
setCurrentState(config, defaultOptions, true); | ||
if ((_a = config[exports.namespace]) === null || _a === void 0 ? void 0 : _a.validateResponse) { | ||
@@ -194,0 +196,0 @@ // by setting this, all HTTP responses will be go through the error interceptor first |
@@ -77,6 +77,8 @@ import isRetryAllowed from 'is-retry-allowed'; | ||
} | ||
function setCurrentState(config, defaultOptions) { | ||
function setCurrentState(config, defaultOptions, resetLastRequestTime = false) { | ||
const currentState = getRequestOptions(config, defaultOptions || {}); | ||
currentState.retryCount = currentState.retryCount || 0; | ||
currentState.lastRequestTime = currentState.lastRequestTime || Date.now(); | ||
if (!currentState.lastRequestTime || resetLastRequestTime) { | ||
currentState.lastRequestTime = Date.now(); | ||
} | ||
config[namespace] = currentState; | ||
@@ -156,3 +158,3 @@ return currentState; | ||
const requestInterceptorId = axiosInstance.interceptors.request.use((config) => { | ||
setCurrentState(config, defaultOptions); | ||
setCurrentState(config, defaultOptions, true); | ||
if (config[namespace]?.validateResponse) { | ||
@@ -159,0 +161,0 @@ // by setting this, all HTTP responses will be go through the error interceptor first |
{ | ||
"name": "axios-retry", | ||
"version": "4.4.1", | ||
"version": "4.4.2", | ||
"author": "Rubén Norte <ruben.norte@softonic.com>", | ||
@@ -5,0 +5,0 @@ "description": "Axios plugin that intercepts failed requests and retries them whenever posible.", |
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
31630
578