[QUESTION] How to log the res.body
See original GitHub issueBy 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:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
@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.
this question should be asked in
pino-http
library, not here, this is just a wrapper with nestjs related features