JSPM

print-response

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q34244F
  • License MIT

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

Package Exports

  • print-response
  • print-response/dist/print-response.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (print-response) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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