# on-http-end

> Allows to capture HTTP response content and headers on request end.

Latest version **1.0.3** (published 2023-04-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install on-http-end
pnpm add on-http-end
yarn add on-http-end
bun add on-http-end
```

## 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.3 |
| Published | 2023-04-07 |
| First published | 2019-05-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Rolando Santamaria Maso |
| Maintainers | jkyberneees |
| Keywords | http, response, content, headers |

## Links

- npm: https://www.npmjs.com/package/on-http-end
- Repository: https://github.com/jkyberneees/on-http-end
- Homepage: https://github.com/jkyberneees/on-http-end#readme
- Issues: https://github.com/jkyberneees/on-http-end/issues
- npm.io page: https://npm.io/package/on-http-end

## Alternatives

- [ext-list](https://npm.io/package/ext-list.md) — 6.3M weekly downloads
- [@lexical/selection](https://npm.io/package/@lexical/selection.md) — 3.8M weekly downloads
- [@lexical/text](https://npm.io/package/@lexical/text.md) — 3.6M weekly downloads
- [@lexical/clipboard](https://npm.io/package/@lexical/clipboard.md) — 3.0M weekly downloads
- [@tiptap/extension-mention](https://npm.io/package/@tiptap/extension-mention.md) — 3.0M weekly downloads

## Recent versions

- 1.0.3 (latest) — 2023-04-07
- 1.0.2 — 2020-04-07
- 1.0.1 — 2019-06-18
- 1.0.0 — 2019-05-28

## README

# on-http-end
Allows to capture HTTP response content and headers on request end.
> Inspired by: https://github.com/kwhitley/apicache/blob/master/src/apicache.js

## Install
```bash
npm i on-http-end
```

## Usage
```js
const onEnd = require('on-http-end')
const http = require('http')

const server = http.createServer((req, res) => {
  onEnd(res, (payload) => {
    console.log(payload)
  })

  res.setHeader('my-header', 'value')
  res.end('Hello Word!', 'utf-8')
})

server.listen(3000)
```

Output:
```bash
{
  status: 200,
  headers: [Object: null prototype] { 'my-header': 'value' },
  data: 'Hello Word!',
  encoding: 'utf-8'
}
```

## Want to contribute?
This is your repo ;)

> Note: We aim to be 100% code coverage, please consider it on your pull requests.

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