requestretry
Advanced tools
Comparing version 1.6.0 to 1.7.0
# Change Log | ||
## [v1.6.0](https://github.com/fgribreau/node-request-retry/tree/v1.6.0) (2015-12-25) | ||
[Full Changelog](https://github.com/fgribreau/node-request-retry/compare/v1.5.0...v1.6.0) | ||
**Closed issues:** | ||
- Check attempts on error [\#21](https://github.com/FGRibreau/node-request-retry/issues/21) | ||
- Feature request: get failure stats in callback [\#12](https://github.com/FGRibreau/node-request-retry/issues/12) | ||
**Merged pull requests:** | ||
- Minor example text fix [\#22](https://github.com/FGRibreau/node-request-retry/pull/22) ([EyePulp](https://github.com/EyePulp)) | ||
- Added promises support [\#20](https://github.com/FGRibreau/node-request-retry/pull/20) ([milsosa](https://github.com/milsosa)) | ||
## [v1.5.0](https://github.com/fgribreau/node-request-retry/tree/v1.5.0) (2015-09-24) | ||
[Full Changelog](https://github.com/fgribreau/node-request-retry/compare/v1.4.1...v1.5.0) | ||
@@ -16,3 +28,2 @@ | ||
## [v1.4.1](https://github.com/fgribreau/node-request-retry/tree/v1.4.1) (2015-09-21) | ||
[Full Changelog](https://github.com/fgribreau/node-request-retry/compare/v1.4.0...v1.4.1) | ||
@@ -25,3 +36,2 @@ | ||
## [v1.4.0](https://github.com/fgribreau/node-request-retry/tree/v1.4.0) (2015-07-16) | ||
[Full Changelog](https://github.com/fgribreau/node-request-retry/compare/v1.3.1...v1.4.0) | ||
@@ -36,11 +46,8 @@ | ||
- add EAI\_AGAIN to the list of retriable network errors [\#13](https://github.com/FGRibreau/node-request-retry/pull/13) ([ejok](https://github.com/ejok)) | ||
- Add notes on request module to readme [\#9](https://github.com/FGRibreau/node-request-retry/pull/9) ([alexkahn](https://github.com/alexkahn)) | ||
## [v1.3.1](https://github.com/fgribreau/node-request-retry/tree/v1.3.1) (2015-05-06) | ||
[Full Changelog](https://github.com/fgribreau/node-request-retry/compare/v1.3.0...v1.3.1) | ||
## [v1.3.0](https://github.com/fgribreau/node-request-retry/tree/v1.3.0) (2015-05-06) | ||
[Full Changelog](https://github.com/fgribreau/node-request-retry/compare/v1.2.2...v1.3.0) | ||
@@ -53,7 +60,5 @@ | ||
## [v1.2.2](https://github.com/fgribreau/node-request-retry/tree/v1.2.2) (2015-01-03) | ||
[Full Changelog](https://github.com/fgribreau/node-request-retry/compare/v1.2.1...v1.2.2) | ||
## [v1.2.1](https://github.com/fgribreau/node-request-retry/tree/v1.2.1) (2014-11-10) | ||
[Full Changelog](https://github.com/fgribreau/node-request-retry/compare/v1.2.0...v1.2.1) | ||
@@ -66,3 +71,2 @@ | ||
## [v1.2.0](https://github.com/fgribreau/node-request-retry/tree/v1.2.0) (2014-11-03) | ||
[Full Changelog](https://github.com/fgribreau/node-request-retry/compare/v1.1.0...v1.2.0) | ||
@@ -72,6 +76,5 @@ | ||
- TypeError: Object \#<Request\> has no method 'setMaxListeners' [\#2](https://github.com/FGRibreau/node-request-retry/issues/2) | ||
- TypeError: Object \#\<Request\> has no method 'setMaxListeners' [\#2](https://github.com/FGRibreau/node-request-retry/issues/2) | ||
## [v1.1.0](https://github.com/fgribreau/node-request-retry/tree/v1.1.0) (2014-10-27) | ||
[Full Changelog](https://github.com/fgribreau/node-request-retry/compare/v1.0.4...v1.1.0) | ||
@@ -84,3 +87,2 @@ | ||
## [v1.0.4](https://github.com/fgribreau/node-request-retry/tree/v1.0.4) (2014-09-30) | ||
[Full Changelog](https://github.com/fgribreau/node-request-retry/compare/v1.0.3...v1.0.4) | ||
@@ -93,7 +95,5 @@ | ||
## [v1.0.3](https://github.com/fgribreau/node-request-retry/tree/v1.0.3) (2014-09-23) | ||
**Closed issues:** | ||
- Are retry requests closed properly? [\#3](https://github.com/FGRibreau/node-request-retry/issues/3) | ||
- Missing "cancelable": "^0.1.0" [\#1](https://github.com/FGRibreau/node-request-retry/issues/1) | ||
@@ -100,0 +100,0 @@ |
16
index.js
@@ -141,5 +141,21 @@ 'use strict'; | ||
function defaults(defaultOptions, defaultF) { | ||
var factory = function (options, f) { | ||
if (typeof options === "string") { | ||
options = { url: options }; | ||
} | ||
return Factory.apply(null, [ _.defaults({}, options, defaultOptions), f || defaultF ]); | ||
}; | ||
factory.defaults = function (newDefaultOptions, newDefaultF) { | ||
return defaults.apply(null, [ _.defaults({}, newDefaultOptions, defaultOptions), newDefaultF || defaultF ]); | ||
}; | ||
factory.Request = Request; | ||
factory.RetryStrategies = RetryStrategies; | ||
return factory; | ||
} | ||
module.exports = Factory; | ||
Factory.defaults = defaults; | ||
Factory.Request = Request; | ||
Factory.RetryStrategies = RetryStrategies; |
{ | ||
"name": "requestretry", | ||
"description": "request-retry wrap nodejs request to retry http(s) requests in case of error", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Francois-Guillaume Ribreau", |
@@ -1,2 +0,3 @@ | ||
# Request-retry [](https://david-dm.org/FGRibreau/node-request-retry) [](https://drone.io/github.com/FGRibreau/node-request-retry/latest) [](https://www.npmjs.com/package/requestretry) | ||
# Request-retry | ||
[](https://david-dm.org/FGRibreau/node-request-retry) [](https://drone.io/github.com/FGRibreau/node-request-retry/latest) [](https://www.npmjs.com/package/requestretry)  | ||
@@ -36,3 +37,3 @@   | ||
- `fullResponse` _(default true)_ - To resolve the promise with the full response or just the body | ||
- `promiseFactory` _(default bluebird)_ - A function to allow the usage of a different promise implementation library | ||
- `promiseFactory` _(default whenjs)_ - A function to allow the usage of a different promise implementation library | ||
@@ -117,6 +118,7 @@ ```javascript | ||
## Modifying `request` options | ||
You can access request's `defaults` method like so: | ||
You can use the `defaults` method to provide default options like so: | ||
```js | ||
var request = require('requestretry').request.defaults({my: options}); | ||
var request = require('requestretry').defaults({ json: true, retryStrategy: myRetryStrategy }); | ||
``` | ||
@@ -126,2 +128,6 @@ | ||
## Donate | ||
I maintain this project in my free time, if it helped you please support my work [via paypal](https://paypal.me/fgribreau) or [Bitcoins](https://www.coinbase.com/fgribreau), thanks a lot! | ||
Copyright 2014, [Francois-Guillaume Ribreau](http://fgribreau.com) (npm@fgribreau.com) |
34092
20
464
131