OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>XMLHttpRequest: open() - allowed case in/sensitive methods test</titl
e> | 4 <title>XMLHttpRequest: open() - allowed case in/sensitive methods test</titl
e> |
5 <script src="../resources/testharness.js"></script> | 5 <script src="../resources/testharness.js"></script> |
6 <script src="../resources/testharnessreport.js"></script> | 6 <script src="../resources/testharnessreport.js"></script> |
7 </head> | 7 </head> |
8 <body> | 8 <body> |
9 <p>Valid methods per step-5 of https://xhr.spec.whatwg.org/#the-open()-metho
d.</p> | 9 <p style="visibility: hidden;">Valid methods per step-5 of https://xhr.spec.
whatwg.org/#the-open()-method.</p> |
10 <script type="text/javascript"> | 10 <script type="text/javascript"> |
11 function testMethod(methodName) { | 11 function testMethod(methodName) { |
12 var client = new XMLHttpRequest(); | 12 var client = new XMLHttpRequest(); |
13 client.open(methodName, "resources/echo-request-method.php"); | 13 client.open(methodName, "resources/echo-request-method.php"); |
14 client.onreadystatechange = function(event) { | 14 client.onreadystatechange = function(event) { |
15 if (event.target.readyState == 4) | 15 if (event.target.readyState == 4) |
16 assert_equals(client.getResponseHeader("x-custom-request-method"), m
ethodName.toUpperCase()); | 16 assert_equals(client.getResponseHeader("x-custom-request-method"), m
ethodName.toUpperCase()); |
17 } | 17 } |
18 client.send(null); | 18 client.send(null); |
19 } | 19 } |
20 | 20 |
21 test(function() { testMethod("PUT"); }); | 21 test(function() { testMethod("PUT"); }); |
22 test(function() { testMethod("Put"); }); | 22 test(function() { testMethod("Put"); }); |
23 test(function() { testMethod("DELETE"); }); | 23 test(function() { testMethod("DELETE"); }); |
24 test(function() { testMethod("DeLeTe"); }); | 24 test(function() { testMethod("DeLeTe"); }); |
25 test(function() { testMethod("HEAD"); }); | 25 test(function() { testMethod("HEAD"); }); |
26 test(function() { testMethod("hEAd"); }); | 26 test(function() { testMethod("hEAd"); }); |
27 test(function() { testMethod("OPTIONS"); }); | 27 test(function() { testMethod("OPTIONS"); }); |
28 test(function() { testMethod("OPtiOns"); }); | 28 test(function() { testMethod("OPtiOns"); }); |
29 test(function() { testMethod("POST"); }); | 29 test(function() { testMethod("POST"); }); |
30 test(function() { testMethod("post"); }); | 30 test(function() { testMethod("post"); }); |
31 test(function() { testMethod("GET"); }); | 31 test(function() { testMethod("GET"); }); |
32 test(function() { testMethod("gEt"); }); | 32 test(function() { testMethod("gEt"); }); |
33 </script> | 33 </script> |
34 </body> | 34 </body> |
35 </html> | 35 </html> |
36 | 36 |
OLD | NEW |