Content-Type header not set
See original GitHub issueDescribe the bug
setting the header ‘Content-Type’ seem to be ignored.
To Reproduce
let data = new FormData();
//... appending values to formdata and then
axios
.request({
url: '/member/tasks/addCommentApi.json',
method: 'POST',
data: data,
headers: {
'Content-Type': 'multipart/form-data',
'X-Test': 'dan',
},
})
Expected behavior
headers should contain Content-Type, they don’t but X-Test header is present.
Environment
- Axios Version [ 0.20.0-0]
- ReactNative [0.62.1]
Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.
nothing else to add
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Top Results From Across the Web
Why do we need to set the Content-Type header of an HTTP ...
Content-Type in the header of a HTTP request specifies to the server what data it should expect. If a server allows and accepts...
Read more >Content-Type - HTTP - MDN Web Docs - Mozilla
The Content-Type representation header is used to indicate the original media type of the resource (prior to any content encoding applied ...
Read more >Setting 'Content-Type' header does not work. #2544 - GitHub
It seems like setting Content-Type header is impossible without data property: const api = Axios.create({ baseURL: 'https://my-url', ...
Read more >Missing Content-Type Header Detected on Web Application
A Missing Content-Type Header is an attack that is similar to a Out of Band Code Evaluation (RoR) that -level severity. Categorized as...
Read more >Content type is not specified - PortSwigger
If a response does not specify a content type, then the browser will usually analyze the response and attempt to determine the MIME...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
thanks @rafamarts , I think it’s still NOT working on react-native.
I have the same issue. I solved by adding data: {}