| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
I used JSON.stringify instead of util.inspect or console.debug because it's probably the most ubiquitous and it gets the job done. I realize that the user can just read the docs and implement their own logging handler, but I think that the default behavior should work instead of not work. My colleague was convinced that this poor logging was the result of the HTTP server returning simplified responses for security reasons. |
Sorry, something went wrong.
|
Stringify always might be too bold and risky. Thoughts on this instead which checks for a JSON content-type in the return? Alternatively, can check if the body is valid JSON regardless of headers. var responseLog = {
debugId: this._debugId,
headers: clone(res.headers),
statusCode: res.statusCode
}
if (res && res.headers && res.headers["content-type"] && res.headers["content-type"].search(/json/i))
responseLog.body = JSON.stringify(res.body);
else
responseLog.body = res.body;
if (this.callback) {
log('response', responseLog, this)
}
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
console.log({ errors: [{ exception: "GreedyLittleHandsException", message: "No pie for you!!" }] })
Will output:
{ errors: [Object] }
Which is not what I want.