-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Honor auth option #1734
Honor auth option #1734
Conversation
Thanks but this is by design. The const ws = new WebSocket('ws://foo:bar@example.com/', { auth: 'baz:qux' });
This is why other options like |
Hi! The In the const opts = {
protocolVersion: protocolVersions[1],
//...
auth: undefined, // this line could even be deleted (?)
...options,
//...
}; it's checked if there is userInfo in the if (parsedUrl.username || parsedUrl.password) {
opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;
} |
Ok, in that case I'm fine with this. |
Thank you. |
Description
The WebSocket client documentation states that all standard http.request() options are valid.
But if you create a new WebSocket client, the
auth
property in the optionsobject
parameter is ignored. And theauth
property is a valid http.request() optionsReproducible in:
Steps to reproduce:
auth
option:Expected result:
The server should receive the
auth
header. Eg:Authorization: Basic dXNlcjpwYXNzd29yZA==
Actual result:
No
auth
header is sent.Fix
When the
opts
object gets initialized, the auth property is set toundefined
, overwriting the value passed in the options object.A little reordering of the properties in the initialization seems to fix the bug.