url: always show password for URL instances

This matches browser behavior.

PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
Brian White authored and Evan Lucas committed 2017-05-02 15:22:44 -05:00
1 parent d154aafe18
commit 60daaaeff2
2 files changed
+2 -5

No files matched your search

+1 -4
View File
@@ -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');
@@ -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;
+1 -1
View File
@@ -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',