Bug 137865 - XMLHttpRequest using wrong default content-type, forcing CORS preflight
Summary: XMLHttpRequest using wrong default content-type, forcing CORS preflight
Status: RESOLVED DUPLICATE of bug 99973
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac (Intel) Other
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-19 12:19 PDT by Chris J. Shull
Modified: 2014-10-21 09:50 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris J. Shull 2014-10-19 12:19:25 PDT
Per http://www.w3.org/TR/XMLHttpRequest2/#the-send-method
When sending a string:
Let mime type be "text/plain;charset=UTF-8".

Now try this with an HTTP proxy/monitor and Safari 8.0:
var xhr = new XMLHttpRequest();
var url = "http://www.corsproxy.com/en.wikipedia.org/wiki/Http?" + Date.now();
xhr.open("POST", url, true);
xhr.send("test");

Observed:
An OPTIONS preflight.
Because the Content-Type in the POST request has been set to application/xml.

Expected:
No OPTIONS preflight.
Content-Type in the POST request to be text/plain;charset=UTF-8.
Comment 1 Chris J. Shull 2014-10-19 12:23:54 PDT
For note, Chrome v38 handles this correctly, as does Forefox v33.
Comment 2 Alexey Proskuryakov 2014-10-20 20:59:11 PDT
I think that "text/plain;charset=UTF-8" would also cause preflight, as the implementation stands now.

*** This bug has been marked as a duplicate of bug 99973 ***
Comment 3 youenn fablet 2014-10-21 01:35:11 PDT
(In reply to comment #2)
> I think that "text/plain;charset=UTF-8" would also cause preflight, as the
> implementation stands now.

The request should already be considered as simple by the latest webkit revision.
I will double check this and report.
Comment 4 Alexey Proskuryakov 2014-10-21 09:50:28 PDT
Yes, looks like I was wrong, it doesn't cause a preflight any more.