# lcm-requester

> lcm-requester is a wrapper on request module with validation on top of format and rules used

Latest version **3.0.1** (published 2020-01-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install lcm-requester
pnpm add lcm-requester
yarn add lcm-requester
bun add lcm-requester
```

## 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 | 3.0.1 |
| Published | 2020-01-22 |
| First published | 2018-09-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.0 |
| Dependencies | 3 |
| Unpacked size | 119.4 KB |
| Known vulnerabilities | 0 (+7 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 4 |
| Maintainers | fox_hellraiser, fxmaxvl, jangolle, lcmbot, legenage, woz |
| Keywords | request, async, await, lcm |

## Links

- npm: https://www.npmjs.com/package/lcm-requester
- Repository: https://github.com/LCMApps/lcm-requester
- Issues: https://github.com/LCMApps/lcm-requester/issues
- npm.io page: https://npm.io/package/lcm-requester

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) 4.17.13
- [request](https://npm.io/package/request.md) 2.88.0
- [dns-lookup-cache](https://npm.io/package/dns-lookup-cache.md) 1.0.3

## Alternatives

- [promise-throttle](https://npm.io/package/promise-throttle.md) — 44.2K weekly downloads
- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads

## Recent versions

- 3.0.1 (latest) — 2020-01-22
- 3.0.0 — 2018-11-08
- 2.2.1 — 2018-10-31
- 2.2.0 — 2018-09-18

## README

# lcm-requester - is a wrapper on request module with validation on top of format and rules used

[![NPM version](https://img.shields.io/npm/v/lcm-requester.svg)](https://www.npmjs.com/package/lcm-requester)
[![Release Status](https://github.com/LCMApps/lcm-requester/workflows/NPM%20Release/badge.svg)](https://github.com/LCMApps/lcm-requester/releases)
[![Build Status](https://travis-ci.org/LCMApps/lcm-requester.svg?branch=master)](https://travis-ci.org/LCMApps/lcm-requester)
[![Coverage Status](https://coveralls.io/repos/github/LCMApps/lcm-requester/badge.svg?branch=master)](https://coveralls.io/github/LCMApps/lcm-requester?branch=master)

# <a name="installation"></a>Installation

Using npm:
```shell
$ npm install --save lcm-requester
```

Using yarn:
```shell
$ yarn add lcm-requester
```

#Configuration
All available transports and configuration options listed below:
Parameter "agentOptions" support the same options like [HTTP Agent](https://nodejs.org/api/http.html#http_new_agent_options)
or [HTTPS Agent](https://nodejs.org/api/https.html#http_new_agent_options)

Example:
```json
{
    "requester": {
        "timeoutMsecs": 1000,
        "timing": true,
        "agentOptions": {
            "keepAlive": true,
            "keepAliveMsecs": 500,
            "maxSockets": 10000,
            "maxFreeSockets": 200,
            "timeout": 2000
        }
    }
}
```
# Super simple to use

```js
const {Requester} = require('lcm-requester');
```
```js
// Use default configuration
const requester = new Requester();
```
```js
// Use custom timeout on request with timing info
const requester = new Requester({
    timeoutMsecs: 2000,
    timing: true
});
```
```js
// Use custom HTTP Agent for requests
const requester = new Requester({
    timeoutMsecs: 2000,
    agentOptions: {
        keepAlive: true
    }
});
```

```js
const {response, responseBody} = await requester.getRequest('https://google.com/path?arg1=val1');
const {response, responseBody} = await requester.postFormUrlencodedRequest('https://google.com/path?arg1=val1');
const {response, responseBody} = await requester.postJsonRequest('https://google.com/path?arg1=val1', {});
const {response, responseBody} = await requester.deleteRequest('https://google.com/path?arg1=val1');
```

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