Describe the bug
The HTTP adapter does not use caseless comparison before overriding the User-Agent header or deleting the Authorization header.
It also overwrites any provided Content-Length header.
To Reproduce
axios({
method: 'post',
url: 'https://postman-echo.com/post',
auth: {
username: 'janedoe',
password: 's00pers3cret'
},
headers: {
authorization: 'foo',
'Content-Length': 10,
'User-agent': 'bar'
},
data: {
firstName: 'Fred',
lastName: 'Flintstone'
}
})
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.log(error);
});
> { args: {},
data: { firstName: 'Fred', lastName: 'Flintstone' },
files: {},
form: {},
headers:
{ 'x-forwarded-proto': 'https',
host: 'postman-echo.com',
'content-length': '44',
accept: 'application/json, text/plain, */*',
authorization: 'foo',
'content-type': 'application/json;charset=utf-8',
'user-agent': 'axios/0.18.1',
'x-forwarded-port': '443' },
json: { firstName: 'Fred', lastName: 'Flintstone' },
url: 'https://postman-echo.com/post' }
Expected behavior
The server should have received the following headers
'x-forwarded-proto': 'https',
host: 'postman-echo.com',
'content-length': '10', // not '44'
accept: 'application/json, text/plain, */*',
authorization: 'Basic amFuZWRvZTpzMDBwZXJzM2NyZXQ=', // not 'foo'
'content-type': 'application/json;charset=utf-8',
'user-agent': 'bar', // not 'axios/0.18.1'
'x-forwarded-port': '443'
I have a PR ready, but saw you prefer an issue be created first.
Describe the bug
The HTTP adapter does not use caseless comparison before overriding the
User-Agentheader or deleting theAuthorizationheader.It also overwrites any provided
Content-Lengthheader.To Reproduce
Expected behavior
The server should have received the following headers
I have a PR ready, but saw you prefer an issue be created first.