Gathering detailed insights and metrics for axios-retry
Gathering detailed insights and metrics for axios-retry
Gathering detailed insights and metrics for axios-retry
Gathering detailed insights and metrics for axios-retry
Axios plugin that intercepts failed requests and retries them whenever possible
npm install axios-retry
Typescript
Module System
Node Version
NPM Version
TypeScript (99.9%)
Shell (0.1%)
Total Downloads
502,669,582
Last Day
741,401
Last Week
3,932,530
Last Month
16,695,729
Last Year
163,745,330
NOASSERTION License
1,956 Stars
268 Commits
171 Forks
28 Watchers
2 Branches
46 Contributors
Updated on May 07, 2025
Minified
Minified + Gzipped
Latest Version
4.5.0
Package Id
axios-retry@4.5.0
Unpacked Size
32.78 kB
Size
6.52 kB
File Count
9
NPM Version
10.8.1
Node Version
20.16.0
Published on
Aug 02, 2024
Cumulative downloads
Total Downloads
Last Day
43.7%
741,401
Compared to previous day
Last Week
5.2%
3,932,530
Compared to previous week
Last Month
1.4%
16,695,729
Compared to previous month
Last Year
31.2%
163,745,330
Compared to previous year
Axios plugin that intercepts failed requests and retries them whenever possible.
1npm install axios-retry
1// CommonJS 2// const axiosRetry = require('axios-retry').default; 3 4// ES6 5import axiosRetry from 'axios-retry'; 6 7axiosRetry(axios, { retries: 3 }); 8 9axios.get('http://example.com/test') // The first request fails and the second returns 'ok' 10 .then(result => { 11 result.data; // 'ok' 12 }); 13 14// Exponential back-off retry delay between requests 15axiosRetry(axios, { retryDelay: axiosRetry.exponentialDelay }); 16 17// Liner retry delay between requests 18axiosRetry(axios, { retryDelay: axiosRetry.linearDelay() }); 19 20// Custom retry delay 21axiosRetry(axios, { retryDelay: (retryCount) => { 22 return retryCount * 1000; 23}}); 24 25// Works with custom axios instances 26const client = axios.create({ baseURL: 'http://example.com' }); 27axiosRetry(client, { retries: 3 }); 28 29client.get('/test') // The first request fails and the second returns 'ok' 30 .then(result => { 31 result.data; // 'ok' 32 }); 33 34// Allows request-specific configuration 35client 36 .get('/test', { 37 'axios-retry': { 38 retries: 0 39 } 40 }) 41 .catch(error => { // The first request fails 42 error !== undefined 43 });
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.
Name | Type | Default | Description |
---|---|---|---|
retries | Number | 3 | The number of times to retry before failing. 1 = One retry after first failure |
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). |
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 in milliseconds between retried requests. By default there is no delay between retries. Another option is exponentialDelay (Exponential Backoff) or linearDelay . The function is passed retryCount and error . |
onRetry | Function | function onRetry(retryCount, error, requestConfig) { return; } | A callback to notify when a retry is about to occur. Useful for tracing and you can any async process for example refresh a token on 401. By default nothing will occur. The function is passed retryCount , error , and requestConfig . |
onMaxRetryTimesExceeded | Function | function onMaxRetryTimesExceeded(error, retryCount) { return; } | After all the retries are failed, this callback will be called with the last error before throwing the error. |
validateResponse | Function | null | null | A callback to define whether a response should be resolved or rejected. If null is passed, it will fallback to the axios default (only 2xx status codes are resolved). |
Clone the repository and execute:
1npm test
git clone https://github.com/softonic/axios-retry.git
git checkout -b feature/my-new-feature
git commit -am 'Added some feature'
npm run build
git push origin my-new-feature
No vulnerabilities found.
Reason
security policy file detected
Details
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 7/17 approved changesets -- score normalized to 4
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
7 existing vulnerabilities detected
Details
Reason
1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-04-28
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More