# node-request-retry

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

Latest version **1.0.0** (published 2015-02-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-request-retry
pnpm add node-request-retry
yarn add node-request-retry
bun add node-request-retry
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2015-02-03 |
| First published | 2014-11-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | DoSomething.org |
| Maintainers | jonuy |

## Links

- npm: https://www.npmjs.com/package/node-request-retry
- Repository: https://github.com/DoSomething/node-request-retry
- Issues: https://github.com/DoSomething/node-request-retry/issues
- npm.io page: https://npm.io/package/node-request-retry

## Dependencies (1)

- [request](https://npm.io/package/request.md) ^2.48.0

## Recent versions

- 1.0.0 (latest) — 2015-02-03
- 0.0.2 — 2014-11-14
- 0.0.1 — 2014-11-13

## README

# 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);
```

---
_Source: https://npm.io/package/node-request-retry · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
