Bug 137865
| Summary: | XMLHttpRequest using wrong default content-type, forcing CORS preflight | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Chris J. Shull <chrisjshull> |
| Component: | New Bugs | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | Normal | CC: | ap, youennf |
| Priority: | P2 | ||
| Version: | 528+ (Nightly build) | ||
| Hardware: | Mac (Intel) | ||
| OS: | Other | ||
Chris J. Shull
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.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Chris J. Shull
For note, Chrome v38 handles this correctly, as does Forefox v33.
Alexey Proskuryakov
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 ***
youenn fablet
(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.
Alexey Proskuryakov
Yes, looks like I was wrong, it doesn't cause a preflight any more.