1.0.0 • Published 1 year ago

print-response v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

print-response

Print beautified Fastify inject-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

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

app.inject({ method: 'GET', url: 'sample/usersZZ' }).then(printResponse) fastify.inject() response

Usage

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})
}