Describe the bug
I'm sending a GET request with basic authentication, where the username contains @ - so I'm escaping it to %40.
Username: my@email.com
Password: pass
URL: http://my%40email.com:pass@127.0.0.1:3000
When using Axios 0.27.2 - it works propely, but when I tried Axios 1.1.3 the authentication failed.
To debug it, I built a server that prints the credentials from the request, and I saw that using Axios 0.27.2, the received username was my@email.com, but with version 1.1.3 the received username was my%40email.com (and that's why the auth failed).
I also tried to send the request without escaping it (which looks weird, but I gave it a go - http://my@email.com:pass@127.0.0.1:3000) and the result was the same (failed).
To Reproduce
Run server.js:
const express = require('express');
const basicAuth = require('basic-auth');
let app = express();
app.get('/', function (req, res) {
let user = basicAuth(req);
console.log(user.name); //prints username
console.log(user.pass); //prints password
});
app.listen(3000, function () {});
Then run this code twice - once with Axios 0.27.2 and once with 1.1.3:
const axios = require('axios');
axios.get('http://my%40email.com:pass@127.0.0.1:3000');
Test result after running with Axios 0.27.2:
Test result after running with Axios 1.1.3:
Code snippet
No response
Expected behavior
I expect the Basic auth username to be sent without further encoding (my@email.com in the example above) - just like in Axios 0.27.2
Axios Version
1.1.3
Adapter Version
No response
Browser
No response
Browser Version
No response
Node.js Version
16.14.2
OS
Windows 11, CentOS Linux 7 (Core)
Additional Library Versions
No response
Additional context/Screenshots
No response
Describe the bug
I'm sending a GET request with basic authentication, where the username contains
@- so I'm escaping it to%40.Username: my@email.com
Password: pass
URL:
http://my%40email.com:pass@127.0.0.1:3000When using Axios 0.27.2 - it works propely, but when I tried Axios 1.1.3 the authentication failed.
To debug it, I built a server that prints the credentials from the request, and I saw that using Axios 0.27.2, the received username was
my@email.com, but with version 1.1.3 the received username wasmy%40email.com(and that's why the auth failed).I also tried to send the request without escaping it (which looks weird, but I gave it a go -
http://my@email.com:pass@127.0.0.1:3000) and the result was the same (failed).To Reproduce
Run server.js:
Then run this code twice - once with Axios 0.27.2 and once with 1.1.3:
Test result after running with Axios 0.27.2:
Test result after running with Axios 1.1.3:
Code snippet
No response
Expected behavior
I expect the Basic auth username to be sent without further encoding (
my@email.comin the example above) - just like in Axios 0.27.2Axios Version
1.1.3
Adapter Version
No response
Browser
No response
Browser Version
No response
Node.js Version
16.14.2
OS
Windows 11, CentOS Linux 7 (Core)
Additional Library Versions
No response
Additional context/Screenshots
No response