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.
  • Loading branch information
mscdex committed Apr 25, 2017
1 parent d457a98 commit bd7c5c9
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 @@ -206,8 +206,6 @@ class URL {
throw new errors.TypeError('ERR_INVALID_THIS', 'URL');
}

const ctx = this[context];

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

Expand All @@ -221,8 +219,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 bd7c5c9

Please sign in to comment.