axios: Axios request fail to authenticate while using headers
Describe the issue Upgrading from 0.18 to 0.19 version is causing an issue in HTTP requests - GET, POST when sending headers like cookie.
Example Code
const requestOptions = {
baseURL: 'http://localhost:3000',
url: `${endPoint}${ids}`,
method: 'GET',
responseType: 'json',
timeout: 100000,
headers: {
VerificationToken: userToken,
Cookie: cookie,
'Content-Type': 'application/x-www-form-urlencoded',
},
};
axios(requestOptions)
.then((response) => {
// Trigger in case, if it is not authenticated
if (typeof response.data === 'string') {
console.log('It is working here');
}else {
console.log('It should Work here');
}
})
.catch((error) => {
});
Expected behavior, if applicable Api should return expected result as it was giving in ver 0.18.0`
Environment:
- Axios Version [e.g. 0.19.0]
- OS: [e.g. OSX Mojave]
- Browser [e.g. Chrome [Electron] ]
- Electron Version [e.g. 4.0.4]
Additional context/Screenshots It is working flawless in ver 0.18.0, but not in ver 0.19.0 if we hit request (GET, POST) that requires headers.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17
Closed due to stale. And feel free to open a new issue if someone met similar problem.
@feed4rz It should be related to #2567 and will be fixed in #2844.