# print-response

> Terminal output of Fastify http response received by .inject() command

Latest version **1.0.0** (published 2023-05-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install print-response
pnpm add print-response
yarn add print-response
bun add print-response
```

## 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 | 2023-05-11 |
| First published | 2023-05-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 49.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | mkant@list.ru |
| Maintainers | mkant |
| Keywords | terminal, console, beautify, print, HTTP, Fastify, inject |

## Links

- npm: https://www.npmjs.com/package/print-response
- Repository: https://github.com/m-kant/print-response
- Homepage: https://github.com/m-kant/print-response#readme
- Issues: https://github.com/m-kant/print-response/issues
- npm.io page: https://npm.io/package/print-response

## Dependencies (1)

- [obj-console](https://npm.io/package/obj-console.md) ^1.0.2

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2023-05-11

## README

# print-response

Print beautified **[Fastify](https://www.npmjs.com/package/fastify) [inject](https://www.fastify.io/docs/latest/Guides/Testing/#benefits-of-using-fastifyinject)**-response in terminal. Color indication of http-status and http-method, brief representation of massive body, optional headers output.

`app.inject({ method: 'GET', url: 'sample/users' }).then(response => {printResponse(response, {showHeaders: true})})`

![fastify.inject() response](https://github.com/m-kant/print-response/raw/main/docs/2023-05-11_16-24-40.png)

`app.inject({ method: 'GET', url: 'sample/users/2' }).then(printResponse)`
![fastify.inject() response](https://github.com/m-kant/print-response/raw/main/docs/2023-05-11_16-25-43.png)

`app.inject({ method: 'GET', url: 'sample/usersZZ' }).then(printResponse)`
![fastify.inject() response](https://github.com/m-kant/print-response/raw/main/docs/2023-05-11_16-27-21.png)

## Usage

```javascript
import app from "./fastify-app";
import printResponse from 'print-response';

app.inject({ method: 'GET', url: 'sample/users/2' }).then(printResponse)

// with async/await
main();
async function main(){
  response = await app.inject({ method: 'GET', url: 'sample/users' })
  printResponse(response, {showHeaders: true})
}
```

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