Socket
Book a DemoInstallSign in
Socket

node-request-retry

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-request-retry

A simple Node.js request wrapper for retrying http requests.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

node-request-retry

A simple Node.js request wrapper for retrying http requests.

Usage

var RequestRetry = require('node-request-retry');

var requestRetry = new RequestRetry();

var retryConditions = [];
// Retries can be triggered by either receiving a certain status code
Array.prototype.push.apply(retryConditions, [400, 404, 408, 500]);

// ... or by evaluating a function. Returning true means the request should be retried.
var fnShouldRetry = function(response, body) {
  if (body == false)
    return true;
  else
    return false;
};
retryConditions[retryConditions.length] = fnShouldRetry;

requestRetry.setRetryCodes(retryConditions);

// POST
requestRetry.post(url, postData, function(err, response, body) {
  /* ... */
});

Modify Defaults

var RequestRetry = require('node-request-retry');

// A wrapper for request.defaults(obj);
RequestRetry.setDefaults({timeout: 30000});

// Default is 3
Request.setMaxRetries(5);

// Default is 10000
Request.setRetryDelay(20000);

FAQs

Package last updated on 03 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.