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
97.8
Supply Chain
96.6
Quality
77.3
Maintenance
100
Vulnerability
100
License
TypeScript (99.9%)
Shell (0.1%)
Total Downloads
515,837,977
Last Day
213,220
Last Week
4,104,689
Last Month
17,100,925
Last Year
167,682,213
NOASSERTION License
1,967 Stars
271 Commits
171 Forks
27 Watchers
2 Branches
47 Contributors
Updated on Jun 25, 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
20.6%
213,220
Compared to previous day
Last Week
-0.7%
4,104,689
Compared to previous week
Last Month
3.6%
17,100,925
Compared to previous month
Last Year
31.9%
167,682,213
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
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
security policy file detected
Details
Reason
license file detected
Details
Reason
Found 8/18 approved changesets -- score normalized to 4
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
3 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2
Reason
8 existing vulnerabilities detected
Details
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-06-23
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