Index: LayoutTests/http/tests/xmlhttprequest/method-names.html |
diff --git a/LayoutTests/http/tests/xmlhttprequest/method-names.html b/LayoutTests/http/tests/xmlhttprequest/method-names.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c3a4bcec92344dfba8b646513d5ff2bedb0c4cda |
--- /dev/null |
+++ b/LayoutTests/http/tests/xmlhttprequest/method-names.html |
@@ -0,0 +1,41 @@ |
+<html> |
+<head> |
+ <script src="/js-test-resources/js-test.js"></script> |
+</head> |
+<body> |
+<script> |
+ description("Test that open() converts only special request methods to uppercase, per http://xhr.spec.whatwg.org/#dom-xmlhttprequest-open"); |
+ var req; |
+ if (window.testRunner) |
+ testRunner.dumpAsText(); |
+ |
+ function testMethod(method, expected, noBody) { |
+ req = new XMLHttpRequest; |
+ req.open(method, "method-name.cgi", false); |
+ req.send(""); |
+ shouldBeEqualToString("req.getResponseHeader('x-request-method')", expected); |
+ if (!noBody) { |
+ shouldBeEqualToString("req.responseText", expected); |
+ } |
+ req = null; |
+ } |
+ |
+ debug("Known methods to be converted to upper-case"); |
+ testMethod("DeleTe", "DELETE"); |
+ testMethod("gET", "GET"); |
+ testMethod("heaD", "HEAD", true); |
+ testMethod("oPTioNS", "OPTIONS"); |
+ testMethod("Post", "POST"); |
+ testMethod("put", "PUT"); |
+ |
+ debug("Other methods should be sent as-is"); |
+ testMethod("pAtCH", "pAtCH"); |
+ testMethod("XuniCORn", "XuniCORn"); |
+ testMethod("LOck", "LOck"); |
+ testMethod("LOck", "LOck"); |
+ testMethod("unLOCK", "unLOCK"); |
+ testMethod("m-post", "m-post"); |
+ testMethod("iNdex", "iNdex"); |
+</script> |
+</body> |
+</html> |