Skip to content
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

Merged

Conversation

pedrobranco
Copy link
Contributor

This PR fixes #12 and also removes the custom request serializer fordebugnyan, and handles it directly before logging to debugnyan.

@pedrobranco pedrobranco force-pushed the bugfix/fix-modifying-by-reference branch 8 times, most recently from 0a5f749 to 937d225 Compare January 12, 2017 17:39

export function obfuscate(request) {
// Obfuscate the API key on `uri`.
if (request.uri) {
Copy link
Owner

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*****');
Copy link
Owner

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*****');
Copy link
Owner

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?

@pedrobranco pedrobranco force-pushed the bugfix/fix-modifying-by-reference branch from 937d225 to c815412 Compare January 12, 2017 19:07
* Module dependencies.
*/

import _ from 'lodash';
Copy link
Owner

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'
Copy link
Owner

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';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import { defaults } for consistency?

@pedrobranco pedrobranco force-pushed the bugfix/fix-modifying-by-reference branch from c815412 to ef43342 Compare January 12, 2017 19:26
@pedrobranco pedrobranco force-pushed the bugfix/fix-modifying-by-reference branch from ef43342 to b78435d Compare January 12, 2017 19:28
@ruimarinho
Copy link
Owner

Thank you for the PR. This looks awesome!

@ruimarinho ruimarinho merged commit ab25634 into ruimarinho:master Jan 12, 2017
@ruimarinho ruimarinho deleted the bugfix/fix-modifying-by-reference branch January 12, 2017 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Logging options override cached request object
2 participants