Open pmmmwh opened 4 years ago
When the username is empty and a password is available, the returned value of auth should align with output from Node's url module.
auth
url
const url = require('url'); const nativeUrl = require('native-url'); url.parse('http://:password@test.com'); // { auth: ':password', ... } nativeUrl.parse('http://:password@test.com'); // { auth: ':password', ... }
const url = require('url'); const nativeUrl = require('native-url'); url.parse('http://:password@test.com'); // { auth: ':password', ... } nativeUrl.parse('http://:password@test.com'); // { auth: 'password', ... }
As described in code blocks above.
The culprit is this block, where all falsy values are filtered out.
https://github.com/GoogleChromeLabs/native-url/blob/0c5aec20a765bc6a396b6066abf6951dbb5d000d/src/parse.js#L188-L191
I do think that this should technically be non-compliant with the spec (HTTP Basic Auth requires username to be defined) though ... ?
Expected Behavior
When the username is empty and a password is available, the returned value of
auth
should align with output from Node'surl
module.Actual Behavior
Steps to Reproduce the Problem
As described in code blocks above.
The culprit is this block, where all falsy values are filtered out.
https://github.com/GoogleChromeLabs/native-url/blob/0c5aec20a765bc6a396b6066abf6951dbb5d000d/src/parse.js#L188-L191
I do think that this should technically be non-compliant with the spec (HTTP Basic Auth requires username to be defined) though ... ?
Specifications