Skip to content

Commit d7ba2a6

Browse files
mscdexjasnell
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 e8f3163 commit d7ba2a6

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
@@ -206,8 +206,6 @@ class URL {
206206
throw new errors.TypeError('ERR_INVALID_THIS', 'URL');
207207
}
208208

209-
const ctx = this[context];
210-
211209
if (typeof depth === 'number' && depth < 0)
212210
return opts.stylize('[Object]', 'special');
213211

@@ -221,8 +219,7 @@ class URL {
221219
obj.origin = this.origin;
222220
obj.protocol = this.protocol;
223221
obj.username = this.username;
224-
obj.password = (opts.showHidden || ctx.password === '') ?
225-
this.password : '--------';
222+
obj.password = this.password;
226223
obj.host = this.host;
227224
obj.hostname = this.hostname;
228225
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)