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".
As seen above, the request header is overridden by the default one (or not being set at all)
"Content-Type" should be set to "application/json", but isn't.
Removing the following lines in the runtime.js of the AJAX -plugin (line 218-224), seem to fix this problem: