Created
September 14, 2017 18:36
-
-
Save s3rious/506dd37c6de0ae3577a12e515ed1541c to your computer and use it in GitHub Desktop.
axios retry with delay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var axios = require('axios') | |
var axiosRetry = require('axios-retry') | |
axiosRetry(axios, { | |
retries: 3, | |
delay: function (retryCount) { | |
console.log(retryCount) | |
return 1000 | |
}, | |
retryCondition: function() { | |
return true | |
} | |
}); | |
axios.get('example.com/123') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "axretest", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"axios": "^0.16.2", | |
"axios-retry": "github:s3rious/axios-retry" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment