Skip to content

Commit

Permalink
url: always show password for URL instances
Browse files Browse the repository at this point in the history
This matches browser behavior.

PR-URL: #12420
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Timothy Gu <[email protected]>
Reviewed-By: Daijiro Wachi <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
  • Loading branch information
mscdex authored and evanlucas committed May 1, 2017
1 parent 41e052a commit a2d3161
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions lib/internal/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,6 @@ class URL {
throw new TypeError('Value of `this` is not a URL');
}

const ctx = this[context];

if (typeof depth === 'number' && depth < 0)
return opts.stylize('[Object]', 'special');

Expand All @@ -230,8 +228,7 @@ class URL {
obj.origin = this.origin;
obj.protocol = this.protocol;
obj.username = this.username;
obj.password = (opts.showHidden || ctx.password === '') ?
this.password : '--------';
obj.password = this.password;
obj.host = this.host;
obj.hostname = this.hostname;
obj.port = this.port;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-whatwg-url-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ assert.strictEqual(
origin: 'https://host.name:8080',
protocol: 'https:',
username: 'username',
password: '--------',
password: 'password',
host: 'host.name:8080',
hostname: 'host.name',
port: '8080',
Expand Down

0 comments on commit a2d3161

Please sign in to comment.