Package Exports
- requestretry
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (requestretry) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Request-retry 
When the connection fails with one of ECONNRESET
, ENOTFOUND
, ESOCKETTIMEDOUT
, ETIMEDOUT
, ECONNREFUSED
or when an HTTP 5xx error occurrs, the request will automatically be re-attempted as these are often recoverable errors and will go away on retry.
Usage
Request-retry is a drop-in replacement for request but adds two new options maxAttempts
and retryDelay
.
var request = require('requestretry');
request({
url: 'https://api.domain.com/v1/a/b'
json:true,
// The above parameters are specific to Request-retry:
maxAttempts: 5, // (default) try 5 times
retryDelay: 5000 // (default) wait for 5s before trying again
}, function(err, response, body){
// this callback will only be called when the request succeeded or after maxAttempts.
});
Installation
Install with npm.
npm install --save requestretry
Changelog
v1.0.0: Initial commit
Copyright 2014, Francois-Guillaume Ribreau (npm@fgribreau.com)