vlerdas-http-retry
Module to submit an HTTP request with configurable retry logic for failed attempts
Installation
npm install http-retry
Current Status
This module is currently under development
Tutorial
Input
{
"reqOptions": url || {options object},
"successCodes": [],
"failureNoRetryCodes": [],
"retry" : {}
}
Parameters
- reqOptions - request options as defined in https://github.com/mikeal/request
- successCodes - an array of http response codes identified by calling function as the only codes considered successful; requests, for which the codes are returned, will NOT be retried
- failureNoRetryCodes - an array of http response codes identified by calling function as failure codes for which NO retries will be attempted
- retry - retry options as defined in https://github.com/tim-kos/node-retry
Output
{
"response": {http.IncomingMessage object},
"body": {response body},
"retryFailure" : true | false
}
Parameters
- response - response statusCode, headers, etc.
- body - response body
- retryFailure - set to true if retry attempts failed; default is false
Usage
var options = {
"reqOptions": {
url: 'http://localhost:3001/ecrud/v1/core/electronicCaseFiles?query=%7B%22case:ElectronicCaseFile.case:CommonData.nc:Person.nc:PersonSSNIdentification.nc:IdentificationID%22:%22333428888%22%7D&sort=%7B%22$natural%22:-1%7D&limit=1',
method: 'GET'
},
successCodes: [200],
failureNoRetryCodes: [404, 405],
"retry" : {
"retries" : 2,
"factor" : 3,
"minTimeout" : 1000,
"maxTimeout" : 60000,
"randomize" : true
}
};
Created with Nodeclipse
(Eclipse Marketplace, site)
Nodeclipse is free open-source project that grows with your contributions.
http-retry
module to submit an HTTP request with configurable retry logic for failed attempts