AuthBox.RequestPromiseRetry
Wrapper of request-promise to support retries using AuthBox.AsyncRetry
Usage
The library wraps the method version of request-promise. It is designed to be a drop in replacement. The most basic usage is:
const rp = require('authbox.request-promise-retry'); // Only need to change require
return await rp({
method: 'GET',
uri: 'http://www.education.gov.uk',
});
The above example will pass all the options directly to request-promise, but will wrap the call in a retry using the default api strategy from AuthBox.AsyncRetry.
You can also specify your own retry strategy:
const rp = require('authbox.request-promise-retry');
return await rp({
method: 'GET',
uri: 'http://www.education.gov.uk',
retry: { // Options for authbox.async-retry
retries: 5,
},
});