Problem Description
The problem is with the AJAX-plugin. It seems calling "setRequestHeader" to change the "Content-Type" of the request doesn't work. It uses the default value of: "application/x-www-form-urlencoded" even if you change it to something else.
When looking at the code in the Plugin it does indeed seems like it should work, I even printed the headers and it seemed correct.
Steps to Reproduce Bug
- Add AJAX object to Layout
- In: On Layout Start, set the header: "Content-Type" to Value: "application/json"
- Make an AJAX request to some server
- Observe on the server that the Content-Type that is being sent is "application/x-www-form-urlencoded".
Observed Result
As seen above, the request header is overridden by the default one (or not being set at all)
Expected Result
"Content-Type" should be set to "application/json", but isn't.
Solution
Removing the following lines in the runtime.js of the AJAX -plugin (line 218-224), seem to fix this problem:
if (data_)
{
if (request["setRequestHeader"])
{
request["setRequestHeader"]("Content-Type", "application/x-www-form-urlencoded");
}
}[/code:fsszne24]
[b]Construct 2 Version ID[/b]
Release 190 (64-bit)