Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: LayoutTests/http/tests/xmlhttprequest/access-control-basic-post-success-no-content-type.html

Issue 22601002: Correct the default Content-Type for XHR Post with string data as per XHR specification. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <html> 1 <html>
2 <body> 2 <body>
3 <p>Test that 'Origin' is not included in Access-Control-Request-Headers in a pre flight request. Should print PASS.</p> 3 <p>Test that POST requests with text content and no content-type set explicitly< br>doesn't generate a preflight request.
4 Should print PASS.</p>
4 <div id="log"></div> 5 <div id="log"></div>
5 <script> 6 <script>
6 function log(message) { 7 function log(message) {
7 document.getElementById("log").innerHTML += message + "<br>"; 8 document.getElementById("log").innerHTML += message + "<br>";
8 } 9 }
9 10
10 if (window.layoutTestController) { 11 if (window.layoutTestController) {
11 layoutTestController.dumpAsText(); 12 layoutTestController.dumpAsText();
12 layoutTestController.waitUntilDone(); 13 layoutTestController.waitUntilDone();
13 } 14 }
14 15
15 var xhr = new XMLHttpRequest(); 16 var xhr = new XMLHttpRequest();
16 xhr.open("GET", "http://localhost:8000/xmlhttprequest/resources/access-control-p reflight-request-headers-origin.php"); 17
17 xhr.setRequestHeader("X-Custom-Header", "PASS"); 18 xhr.open("POST", "http://localhost:8000/xmlhttprequest/resources/access-control- basic-post-success-no-content-type.php");
18 xhr.onerror = function () { 19 xhr.onerror = function () {
19 log("FAIL"); 20 log("FAIL");
20 if (window.layoutTestController) 21 if (window.layoutTestController)
21 layoutTestController.notifyDone(); 22 layoutTestController.notifyDone();
22 }; 23 };
23 xhr.onreadystatechange = function () { 24 xhr.onload = function () {
24 if (xhr.readyState == 4) { 25 if (xhr.readyState == 4) {
25 log(xhr.responseText); 26 log(xhr.responseText);
26 if (window.layoutTestController) 27 if (window.layoutTestController)
27 layoutTestController.notifyDone(); 28 layoutTestController.notifyDone();
28 } 29 }
29 }; 30 };
30 xhr.send(); 31 xhr.send('Test');
31
32 </script> 32 </script>
33 </html> 33 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698