Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lost auth with toString when password is empty #212

Closed
bluelovers opened this issue Aug 11, 2021 · 3 comments
Closed

lost auth with toString when password is empty #212

bluelovers opened this issue Aug 11, 2021 · 3 comments

Comments

@bluelovers
Copy link
Contributor

{
  slashes: true,
  protocol: 'https:',
  hash: '',
  query: { ID: '12345' },
  pathname: '/tw/user',
  auth: 'user:',
  host: 'mozilla.org:8989',
  port: '8989',
  hostname: 'mozilla.org',
  password: '',
  username: '',
  origin: 'https://mozilla.org:8989',
  href: 'https://mozilla.org:8989/tw/user?ID=12345'
}
'https://mozilla.org:8989/tw/user?ID=12345'
@lpinca
Copy link
Member

lpinca commented Aug 12, 2021

Did you set auth manually with Url.prototype.set()? If so that's expected because Url.prototype.toString() uses username and password and both are empty.

@bluelovers
Copy link
Contributor Author

bluelovers commented Aug 12, 2021

so i can't use .set('auth', 'user:') ?

i have split it and use .set('username', ) , .set('password', ) for make sure work as expected ?

hope can like this, auto do it when set auth

https://github.com/bluelovers/lazy-url/blob/41268c521048ba4880494d79cd9a11a4d7e4e005/lib/index.ts#L346-L358

@lpinca
Copy link
Member

lpinca commented Aug 12, 2021

i have split it and use .set('username', ) , .set('password', ) for make sure work as expected ?

Yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants