0.0.4 • Published 9 years ago
fetch-retry-or-die v0.0.4
fetch-retry-or-die 
A wrapper around isomorphic-fetch that allows retries in case of request failure
Install
npm install [-S] fetch-retry-or-dieUsage
const fetch = require('fetch-retry-or-die');let url = 'http://some.url'
fetch(url, {maxRetries: 5, retryDelay: 500})
.then((response) => {
// do something with the response
...
});Options
maxRetries: the maximum number of allowed retries. Defaults to 1.retryDelay: the delay between retries in milliseconds. Defaults to 100.
Handles HTTP error statuses
- Standard
fetchfunctionality does not reject the promise on HTTP error status codes like 500. fetch-retry-or-dierejects the promise if the status code is not 2XX or 404 (no need to retry if resource wasn't found, right?).