OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script src="/js-test-resources/js-test.js"></script> |
| 4 </head> |
| 5 <body> |
| 6 <script> |
| 7 description("Test that open() converts only special request methods to upper
case, per http://xhr.spec.whatwg.org/#dom-xmlhttprequest-open"); |
| 8 var req; |
| 9 if (window.testRunner) |
| 10 testRunner.dumpAsText(); |
| 11 |
| 12 function testMethod(method, expected, noBody) { |
| 13 req = new XMLHttpRequest; |
| 14 req.open(method, "method-name.cgi", false); |
| 15 req.send(""); |
| 16 shouldBeEqualToString("req.getResponseHeader('x-request-method')", expecte
d); |
| 17 if (!noBody) { |
| 18 shouldBeEqualToString("req.responseText", expected); |
| 19 } |
| 20 req = null; |
| 21 } |
| 22 |
| 23 debug("Known methods to be converted to upper-case"); |
| 24 testMethod("DeleTe", "DELETE"); |
| 25 testMethod("gET", "GET"); |
| 26 testMethod("heaD", "HEAD", true); |
| 27 testMethod("oPTioNS", "OPTIONS"); |
| 28 testMethod("Post", "POST"); |
| 29 testMethod("put", "PUT"); |
| 30 |
| 31 debug("Other methods should be sent as-is"); |
| 32 testMethod("pAtCH", "pAtCH"); |
| 33 testMethod("XuniCORn", "XuniCORn"); |
| 34 testMethod("LOck", "LOck"); |
| 35 testMethod("LOck", "LOck"); |
| 36 testMethod("unLOCK", "unLOCK"); |
| 37 testMethod("m-post", "m-post"); |
| 38 testMethod("iNdex", "iNdex"); |
| 39 </script> |
| 40 </body> |
| 41 </html> |
OLD | NEW |