print-response
v1.0.0
Published
Terminal output of Fastify http response received by .inject() command
Downloads
2
Maintainers
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})})
app.inject({ method: 'GET', url: 'sample/users/2' }).then(printResponse)
app.inject({ method: 'GET', url: 'sample/usersZZ' }).then(printResponse)
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})
}