You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a particular use case where I want to log all outgoing requests and responses but need to obfuscate sensitive information such as passwords, tokens etc. from the log messages. Previously, my Bunyan serializer was just able to go through any body object and remove sensitive values from any keys that I declared sensitive. But as the data.body is not what it originally was when sending the request, I would have to JSON.parse(data.body) it again.
Thanks :-)
The text was updated successfully, but these errors were encountered:
tobiasbueschel
changed the title
Why is there request.body stringified?
Why is data.body stringified on request events?
Mar 6, 2018
I would imagine it's because this library is primarily about HTTP requests, and request bodies are always strings as they are sent across the HTTP protocol.
So for debugging the protocol it's useful to have the data in the form that it is actually when sent across HTTP.
Thanks for all the work with this library. It's really useful :-)
One thing I have noticed is that on request events,
data.body
is stringified as seen here:[index.js, line: 36]
Just curious why this is done?
I have a particular use case where I want to log all outgoing requests and responses but need to obfuscate sensitive information such as passwords, tokens etc. from the log messages. Previously, my Bunyan serializer was just able to go through any body object and remove sensitive values from any keys that I declared sensitive. But as the
data.body
is not what it originally was when sending the request, I would have toJSON.parse(data.body)
it again.Thanks :-)
The text was updated successfully, but these errors were encountered: