-
-
Notifications
You must be signed in to change notification settings - Fork 969
Closed
Labels
bugSomething does not work as it shouldSomething does not work as it shouldexternalThe issue related to an external projectThe issue related to an external projectnodejs bug
Description
Describe the bug
Actual behavior
When I use the username/password with got, It seems that the combo 'username:password' is encoded with encodeURI() before to be encode in base64 for the basic auth. This first encoding is not necessary due to the base64 encoding and brings problems. So when the encodeURI() change a value like '@' to '%40', the basic authentification doesn't work.
Expected behavior
Just encode the combo 'username:password' with base64 encoding.
Code to reproduce
const got = require('got');
(async () => {
const response = await got.head("http://example.com/", {username: "user@", password: "password@"});
console.info("Response:", response.client._httpMessage._header);
}) ();
We see that the Authorization header is invalid
Checklist
- I have read the documentation.
- I have tried my code with the latest version of Node.js and Got.
epicfaace, HLA-242, alex996, SleepWalker, nikolaik and 8 morepioug
Metadata
Metadata
Assignees
Labels
bugSomething does not work as it shouldSomething does not work as it shouldexternalThe issue related to an external projectThe issue related to an external projectnodejs bug