You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Axios is a promise based HTTP client with browser and Node.js support. As an HTTP client, Axios wants to make sure the sent message contains a proper content-length header as well. So it includes a number type “Content-Length” header by default. This behavior can be observed in /node_modules/axios/lib/adapters/http.js, at line 45.
If request already has a lowercase "content-length" header, since they have different casing, the header included by Axios does not overwrite the one included by the request. So we’re sending two “content-length” headers to the server (same values and different types). I believe this is not the expected behavior we want.
Expected behavior
Before set content-length header, Axios should check if there is a case insensitive "content-length" header.
IF THERE IS AN EXISTING CONTENT-LENGTH HEADER:
COMPARE WITH CONTENT-LENGTH CALCULATED
IF DISMATCH
THROW ERROR
ELSE
SET CONTENT-LENGTH HEADER IN AXIOS
Environment:
Axios Version 0.18.0
OS: Any
Node.js: Any
The text was updated successfully, but these errors were encountered:
Describe the bug
Axios is a promise based HTTP client with browser and Node.js support. As an HTTP client, Axios wants to make sure the sent message contains a proper content-length header as well. So it includes a number type “Content-Length” header by default. This behavior can be observed in /node_modules/axios/lib/adapters/http.js, at line 45.
If request already has a lowercase "content-length" header, since they have different casing, the header included by Axios does not overwrite the one included by the request. So we’re sending two “content-length” headers to the server (same values and different types). I believe this is not the expected behavior we want.
Expected behavior
Before set content-length header, Axios should check if there is a case insensitive "content-length" header.
IF THERE IS AN EXISTING CONTENT-LENGTH HEADER:
COMPARE WITH CONTENT-LENGTH CALCULATED
IF DISMATCH
THROW ERROR
ELSE
SET CONTENT-LENGTH HEADER IN AXIOS
Environment:
The text was updated successfully, but these errors were encountered: