Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Setting the Content-Type header in POST requests do not overwrite default header #1919
If you make a POST request and set the Content-Type header, it will not overwrite the default Content-Type header but rather will get appended to the default header. This does not happen in GET requests. I have not attempted this with any other types.
The expectation is that setting a header in POST requests actually means setting the header, rather than appending to some default header.
The Content-Type header set by the user will get appended to the default header
Steps to Reproduce (for bugs)
Look at the network tab for the below fiddle after running, you'll see the POST request made by the code and see that the Content-Type header is not what the user set it to.
Found the culprit.. mithril assumes that setRequestHeader would overwrite (like any sort of setter/getter...). For some crazy reason this is not the actual beheavior of the method: