New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace request-debug
with request-logger
#24
Replace request-debug
with request-logger
#24
Conversation
0a5f749
to
937d225
Compare
|
||
export function obfuscate(request) { | ||
// Obfuscate the API key on `uri`. | ||
if (request.uri) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When can request.uri be undefined?
export function obfuscate(request) { | ||
// Obfuscate the API key on `uri`. | ||
if (request.uri) { | ||
request.uri = (request.uri || '').replace(replacement, '$1*****'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why coalesce to an empty string here? What other shapes can .uri have?
|
||
// Obfuscate the API key on `body`. | ||
if (request.body && _.isString(request.body)) { | ||
request.body = (request.body || '').replace(replacement, '$1*****'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're already testing if request.body is a string, which coalesce to an empty string?
937d225
to
c815412
Compare
* Module dependencies. | ||
*/ | ||
|
||
import _ from 'lodash'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { isString }
body: 'foo=bar?api_key=foobar', | ||
id: '354f8341-eb27-4c91-a8f7-a30e303a0976', | ||
method: 'GET', | ||
uri: 'foo=bar?api_key=foobar' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace ? by &
* Module dependencies. | ||
*/ | ||
|
||
import _ from 'lodash'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { defaults } for consistency?
c815412
to
ef43342
Compare
ef43342
to
b78435d
Compare
Thank you for the PR. This looks awesome! |
This PR fixes #12 and also removes the custom request serializer for
debugnyan
, and handles it directly before logging todebugnyan
.