# chilli-client

> A spicy REST client for NodeJS.

Latest version **1.0.4** (published 2020-10-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install chilli-client
pnpm add chilli-client
yarn add chilli-client
bun add chilli-client
```

## 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.4 |
| Published | 2020-10-07 |
| First published | 2020-10-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Josh Gude |
| Maintainers | jorygu |
| Keywords | rest, node, client, chilli |

## Links

- npm: https://www.npmjs.com/package/chilli-client
- Repository: https://github.com/JoRyGu/chilli-client
- Issues: https://github.com/JoRyGu/chilli-client/issues
- npm.io page: https://npm.io/package/chilli-client

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2020-10-07
- 1.0.3 — 2020-10-07
- 1.0.2 — 2020-10-07
- 1.0.1 — 2020-10-07
- 1.0.0 — 2020-10-07

## README

# chilli-client 🌶️
#### A very small wrapper around the base node https client that allows you to make requests using Promises and a familiar API.
## Install
```
npm i chilli-client
```
## Usage
### Basic GET Request
```javascript
const chilli = require('chilli-client');

chilli.get('https://google.com')
.then(res => console.log(res));
```
### GET Request With Options
chilli-client accepts the standard https.request options object outlined [here](https://nodejs.org/api/http.html#http_http_request_options_callback). Additionally, you can add the
`includeTimings` and `includeRawResponse` properties to the options object to include an object that contains the time it took various parts of the request to run and the raw 
`http.IncomingMessage` contents.

```javascript
chilli.get('https://google.com', {
  includeTimings: true
}).then(res => {
  console.log(res);
});
```

### POST Request
```javascript
chilli.post('https://google.com', {
  name: 'Samantha',
  password: 'password',
}, {
  includeTimings: true
})
```

### Response Object
chilli-client returns a developer-friendly response object. It does not make any assumptions about the response, and, unlike similar http clients, will not automatically throw
an error when the status code is outside of the 200 range.

```typescript
interface ChilliResponse {
  body: string | Object, // will decode response body to JavaScript object if Content-Type header is application/json
  statusCode: number,
  statusMessage: string,
  raw: http.IncomingMessage,
  timings: Timings
}

interface Timings {
  total: number,
  dnsLookup: number,
  tcpConnection: number,
  tlsHandshake: number,
  firstByte: number,
  streamRes: number
}
```

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