New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

requestretry

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

requestretry - npm Package Compare versions

Comparing version 1.4.1 to 1.5.0

test/attempts.test.js

8

CHANGELOG.md
# Change Log
## [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)
**Merged pull requests:**
- Update dependencies, fixes build status [\#14](https://github.com/FGRibreau/node-request-retry/pull/14) ([fhemberger](https://github.com/fhemberger))
## [v1.4.0](https://github.com/fgribreau/node-request-retry/tree/v1.4.0) (2015-07-16)

@@ -4,0 +12,0 @@

7

index.js

@@ -23,2 +23,3 @@ 'use strict';

this.retryDelay = retryDelay;
this.attempts = 0;

@@ -46,5 +47,9 @@ /**

this.maxAttempts--;
this.attempts++;
this._req = Request.request(this.options, function (err, response, body) {
if (this.retryStrategy(err, response) && this.maxAttempts >= 0) {
if (response) {
response.attempts = this.attempts;
}
if (this.retryStrategy(err, response) && this.maxAttempts > 0) {
this._timeout = setTimeout(this._tryUntilFail.bind(this), this.retryDelay);

@@ -51,0 +56,0 @@ return;

2

package.json
{
"name": "requestretry",
"description": "request-retry wrap nodejs request to retry http(s) requests in case of error",
"version": "1.4.1",
"version": "1.5.0",
"author": {

@@ -6,0 +6,0 @@ "name": "Francois-Guillaume Ribreau",

@@ -9,3 +9,3 @@ # Request-retry [![Deps](https://david-dm.org/FGRibreau/node-request-retry.png)](https://david-dm.org/FGRibreau/node-request-retry) [![Build Status](https://drone.io/github.com/FGRibreau/node-request-retry/status.png)](https://drone.io/github.com/FGRibreau/node-request-retry/latest) [![Downloads](http://img.shields.io/npm/dm/requestretry.svg)](https://www.npmjs.com/package/requestretry)

Request-retry is a drop-in replacement for [request](https://github.com/mikeal/request) but adds two new options `maxAttempts` and `retryDelay`.
Request-retry is a drop-in replacement for [request](https://github.com/mikeal/request) but adds two new options `maxAttempts` and `retryDelay`. It also adds one property to the response, `attempts`.

@@ -25,2 +25,5 @@ ```javascript

// this callback will only be called when the request succeeded or after maxAttempts or on error
if (response) {
console.log('The number of request attempts: ' + response.attempts);
}
});

@@ -67,3 +70,2 @@ ```

- Tests
- Use an EventEmitter to notify retries

@@ -70,0 +72,0 @@ ## [Changelog](CHANGELOG.md)

@@ -9,3 +9,3 @@ 'use strict';

var o = request({
url: 'http://filltext.com/?rows=1&delay=10', // wait for 4s
url: 'http://filltext.com/?rows=1&delay=10', // wait for 10s
json: true

@@ -12,0 +12,0 @@ }, function (err) {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc