Skip to content

Commit 18aec67

Browse files
mscdexevanlucas
authored andcommitted
url: always show password for URL instances
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]>
1 parent f8ae23e commit 18aec67

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

lib/internal/url.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,6 @@ class URL {
215215
throw new TypeError('Value of `this` is not a URL');
216216
}
217217

218-
const ctx = this[context];
219-
220218
if (typeof depth === 'number' && depth < 0)
221219
return opts.stylize('[Object]', 'special');
222220

@@ -230,8 +228,7 @@ class URL {
230228
obj.origin = this.origin;
231229
obj.protocol = this.protocol;
232230
obj.username = this.username;
233-
obj.password = (opts.showHidden || ctx.password === '') ?
234-
this.password : '--------';
231+
obj.password = this.password;
235232
obj.host = this.host;
236233
obj.hostname = this.hostname;
237234
obj.port = this.port;

test/parallel/test-whatwg-url-inspect.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ assert.strictEqual(
2121
origin: 'https://host.name:8080',
2222
protocol: 'https:',
2323
username: 'username',
24-
password: '--------',
24+
password: 'password',
2525
host: 'host.name:8080',
2626
hostname: 'host.name',
2727
port: '8080',

0 commit comments

Comments
 (0)