question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[QUESTION] How to log the res.body

See original GitHub issue

By default, only responseTime, statusCode and headers are logged.

"res":{"statusCode":304,"headers":{...}},"responseTime":15

Is there a configuration to enable logging res.body?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
Jeff-Tiancommented, May 22, 2020

Thanks, by following your provided link, found there is an exact example to log request’s body here:

https://github.com/pinojs/pino-http/pull/76/files

0reactions
iamoleggacommented, Oct 3, 2021

it is so strange to don’t show response body

@skliarovartem nothing strange. response body can be huge, can have sensitive data, can be of a binary type, the current default behaviour is better than anything else.

so, if there a way to simply print response body?

this question should be asked in pino-http library, not here, this is just a wrapper with nestjs related features

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I console.log the res.body in Express nodejs
Try this console.log(res); console.log(res.body) courses.push(course); res.status(200).json(course);. console.log the req.body before ...
Read more >
supertest.Response.body JavaScript and Node.js code ...
yargs the modern, pirate-themed, successor to optimist. q. A library for promises (CommonJS/Promises/A,B,D). request. Simplified HTTP request client.
Read more >
How to get body data in logs for each request in K6
You can just use your the object from your request. For example let res = http.post(url, payload,params); console.log(res.response.body);.
Read more >
Need guidance for Debugging the response data
My understanding of your question is that you'd like to know what the operations: JSON.parse(res.body) and body.data.repository.issues.edges[0].
Read more >
How to test a post request for fetching the result ...
for (let i = 0; i < res.body.length; i++) { const record ... perhaps add some logging or debug the controller and see...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found