axios-retry
Advanced tools
Comparing version 3.1.2 to 3.1.4
import * as axios from 'axios' | ||
export interface IAxiosRetryConfig { | ||
/** | ||
* The number of times to retry before failing | ||
* default: 3 | ||
* | ||
* @type {number} | ||
*/ | ||
retries?: number, | ||
/** | ||
* 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} | ||
*/ | ||
retryCondition?: (error: axios.AxiosError) => boolean, | ||
/** | ||
* A callback to further control the delay between retry requests. By default there is no delay. | ||
* | ||
* @type {Function} | ||
*/ | ||
retryDelay?: (retryCount: number, error: axios.AxiosError) => number | ||
} | ||
export interface IAxiosRetry { | ||
interface IAxiosRetry { | ||
( | ||
axios: axios.AxiosStatic | axios.AxiosInstance, | ||
axiosRetryConfig?: IAxiosRetryConfig | ||
): void | ||
): void; | ||
isNetworkError(error: Error): boolean; | ||
isRetryableError(error: Error): boolean; | ||
isSafeRequestError(error: Error): boolean; | ||
isIdempotentRequestError(error: Error): boolean; | ||
isNetworkOrIdempotentRequestError(error: Error): boolean; | ||
exponentialDelay(retryNumber: number): number; | ||
} | ||
declare const axiosRetry: IAxiosRetry | ||
declare namespace IAxiosRetry { | ||
export interface IAxiosRetryConfig { | ||
/** | ||
* The number of times to retry before failing | ||
* default: 3 | ||
* | ||
* @type {number} | ||
*/ | ||
retries?: number, | ||
/** | ||
* 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} | ||
*/ | ||
retryCondition?: (error: axios.AxiosError) => boolean, | ||
/** | ||
* A callback to further control the delay between retry requests. By default there is no delay. | ||
* | ||
* @type {Function} | ||
*/ | ||
retryDelay?: (retryCount: number, error: axios.AxiosError) => number | ||
} | ||
} | ||
export default axiosRetry | ||
declare const axiosRetry: IAxiosRetry; | ||
export function isNetworkError(error: Error): boolean; | ||
export function isRetryableError(error: Error): boolean; | ||
export function isSafeRequestError(error: Error): boolean; | ||
export function isIdempotentRequestError(error: Error): boolean; | ||
export function isNetworkOrIdempotentRequestError(error: Error): boolean; | ||
export function exponentialDelay(retryNumber: number): number; | ||
export = axiosRetry; |
{ | ||
"name": "axios-retry", | ||
"version": "3.1.2", | ||
"version": "3.1.4", | ||
"author": "Rubén Norte <ruben.norte@softonic.com>", | ||
@@ -5,0 +5,0 @@ "description": "Axios plugin that intercepts failed requests and retries them whenever posible.", |
@@ -13,2 +13,5 @@ # axios-retry | ||
### Note | ||
Not working with `axios 0.19.0`. For details see the [bug](https://github.com/axios/axios/issues/2203). [`axios 0.19.1`](https://github.com/axios/axios/releases/tag/0.19.1) has fixed this bug. | ||
## Usage | ||
@@ -15,0 +18,0 @@ |
Sorry, the diff of this file is not supported yet
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
34588
465
88