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 <benjamingr@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
  • Loading branch information
mscdex authored and evanlucas committed May 2, 2017
1 parent d154aaf commit 60daaae
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 60daaae

Please sign in to comment.