Socket
Socket
Sign inDemoInstall

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.0.2 to 3.1.0

7

CHANGELOG.md

@@ -8,2 +8,9 @@ # Change Log

## [3.0.3] - 2018-04-26
### Fixed
- Export isRetryableError for CommonJS
### Added
- Added additional param shouldResetTimeout
## [3.0.2] - 2018-02-09

@@ -10,0 +17,0 @@

8

es/index.js

@@ -162,2 +162,4 @@ import isRetryAllowed from 'is-retry-allowed';

* @param {number} [defaultOptions.retries=3] Number of retries
* @param {boolean} [defaultOptions.shouldResetTimeout=false]
* Defines if the timeout should be reset between retries
* @param {Function} [defaultOptions.retryCondition=isNetworkOrIdempotentRequestError]

@@ -186,3 +188,4 @@ * A function to determine if the error can be retried

retryCondition = isNetworkOrIdempotentRequestError,
retryDelay = noDelay
retryDelay = noDelay,
shouldResetTimeout = false
} = getRequestOptions(config, defaultOptions);

@@ -203,3 +206,3 @@

if (config.timeout && currentState.lastRequestTime) {
if (!shouldResetTimeout && config.timeout && currentState.lastRequestTime) {
const lastRequestDuration = Date.now() - currentState.lastRequestTime;

@@ -225,1 +228,2 @@ // Minimum 1ms timeout (passing 0 or less to XHR means no timeout)

axiosRetry.exponentialDelay = exponentialDelay;
axiosRetry.isRetryableError = isRetryableError;

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

* default: 3
*
*
* @type {number}

@@ -13,5 +13,12 @@ */

/**
* Defines if the timeout should be reset between retries
* default: false
*
* @type {boolean}
*/
shouldResetTimeout?: boolean,
/**
* A callback to further control if a request should be retried. By default, it retries if the result did not have a response.
* default: error => !error.response
*
*
* @type {Function}

@@ -18,0 +25,0 @@ */

@@ -179,2 +179,4 @@ 'use strict';

* @param {number} [defaultOptions.retries=3] Number of retries
* @param {boolean} [defaultOptions.shouldResetTimeout=false]
* Defines if the timeout should be reset between retries
* @param {Function} [defaultOptions.retryCondition=isNetworkOrIdempotentRequestError]

@@ -206,3 +208,5 @@ * A function to determine if the error can be retried

_getRequestOptions$re3 = _getRequestOptions.retryDelay,
retryDelay = _getRequestOptions$re3 === undefined ? noDelay : _getRequestOptions$re3;
retryDelay = _getRequestOptions$re3 === undefined ? noDelay : _getRequestOptions$re3,
_getRequestOptions$sh = _getRequestOptions.shouldResetTimeout,
shouldResetTimeout = _getRequestOptions$sh === undefined ? false : _getRequestOptions$sh;

@@ -221,3 +225,3 @@ var currentState = getCurrentState(config);

if (config.timeout && currentState.lastRequestTime) {
if (!shouldResetTimeout && config.timeout && currentState.lastRequestTime) {
var lastRequestDuration = Date.now() - currentState.lastRequestTime;

@@ -245,2 +249,3 @@ // Minimum 1ms timeout (passing 0 or less to XHR means no timeout)

axiosRetry.exponentialDelay = exponentialDelay;
axiosRetry.isRetryableError = isRetryableError;
//# sourceMappingURL=index.js.map
{
"name": "axios-retry",
"version": "3.0.2",
"version": "3.1.0",
"author": "Rubén Norte <ruben.norte@softonic.com>",

@@ -5,0 +5,0 @@ "description": "Axios plugin that intercepts failed requests and retries them whenever posible.",

# axios-retry
Axios plugin that intercepts failed requests and retries them whenever posible.
Axios plugin that intercepts failed requests and retries them whenever possible.

@@ -56,3 +56,3 @@ ## Installation

**Note:** the plugin interprets the request timeout as a global value, so it is not used for each retry but for the whole request lifecycle.
**Note:** Unless `shouldResetTimeout` is set, the plugin interprets the request timeout as a global value, so it is not used for each retry but for the whole request lifecycle.

@@ -63,5 +63,6 @@ ## Options

| --- | --- | --- | --- |
| retries | `Number` | 3 | The number of times to retry before failing |
| retries | `Number` | `3` | The number of times to retry before failing. |
| retryCondition | `Function` | `isNetworkOrIdempotentRequestError` | A callback to further control if a request should be retried. By default, it retries if it is a network error or a 5xx error on an idempotent request (GET, HEAD, OPTIONS, PUT or DELETE). |
| retryDelay | `Function` | `0` | A callback to further control the delay between retried requests. By default there is no delay between retries. Another option is exponentialDelay ([Exponential Backoff](https://developers.google.com/analytics/devguides/reporting/core/v3/errors#backoff)). The function is passed `retryCount` and `error`. |
| shouldResetTimeout | `Boolean` | false | Defines if the timeout should be reset between retries |
| retryDelay | `Function` | `function noDelay() { return 0; }` | A callback to further control the delay between retried requests. By default there is no delay between retries. Another option is exponentialDelay ([Exponential Backoff](https://developers.google.com/analytics/devguides/reporting/core/v3/errors#backoff)). The function is passed `retryCount` and `error`. |

@@ -68,0 +69,0 @@ ## Testing

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