Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / xmlhttprequest / methods.html
blobbdc5db2e41d34c9a2f59217f586a3a935178753f
1 <html>
2 <body>
3 <p>Tests for <a href="https://bugs.webkit.org/show_bug.cgi?id=3812"> bug 3812</a> -
4 GET and POST should not be the only HTTP methods implemented in XMLHttpRequest.</p>
5 <script>
6 if (window.testRunner)
7 testRunner.dumpAsText();
9 var console_messages = document.createElement("ol");
10 document.body.appendChild(console_messages);
12 function log(message)
14 var item = document.createElement("li");
15 item.appendChild(document.createTextNode(message));
16 console_messages.appendChild(item);
19 // sync
20 req = new XMLHttpRequest;
21 req.open("GET", "methods.cgi", false);
22 req.send("");
23 log('GET(""): ' + req.getResponseHeader("REQMETHOD") + "(" + req.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req.getResponseHeader("REQTYPE"));
25 req.open("GET", "methods.cgi", false);
26 req.send(null);
27 log('GET(null): ' + req.getResponseHeader("REQMETHOD") + "(" + req.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req.getResponseHeader("REQTYPE"));
29 req.open("GET", "methods.cgi", false);
30 req.send("123");
31 log('GET("123"): ' + req.getResponseHeader("REQMETHOD") + "(" + req.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req.getResponseHeader("REQTYPE"));
33 req.open("POST", "methods.cgi", false);
34 req.send("");
35 log('POST(""): ' + req.getResponseHeader("REQMETHOD") + "(" + req.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req.getResponseHeader("REQTYPE"));
37 req.open("POST", "methods.cgi", false);
38 req.send(null);
39 log('POST(null): ' + req.getResponseHeader("REQMETHOD") + "(" + req.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req.getResponseHeader("REQTYPE"));
41 req.open("POST", "methods.cgi", false);
42 req.send("123");
43 log('POST("123"): ' + req.getResponseHeader("REQMETHOD") + "(" + req.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req.getResponseHeader("REQTYPE"));
45 req.open("PUT", "methods.cgi", false);
46 req.send("");
47 log('PUT(""): ' + req.getResponseHeader("REQMETHOD") + "(" + req.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req.getResponseHeader("REQTYPE"));
49 req.open("PUT", "methods.cgi", false);
50 req.send(null);
51 log('PUT(null): ' + req.getResponseHeader("REQMETHOD") + "(" + req.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req.getResponseHeader("REQTYPE"));
53 req.open("PUT", "methods.cgi", false);
54 req.send("123");
55 log('PUT("123"): ' + req.getResponseHeader("REQMETHOD") + "(" + req.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req.getResponseHeader("REQTYPE"));
57 req.open("DELETE", "methods.cgi", false);
58 req.send("");
59 log('DELETE(""): ' + req.getResponseHeader("REQMETHOD") + "(" + req.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req.getResponseHeader("REQTYPE"));
61 req.open("DELETE", "methods.cgi", false);
62 req.send(null);
63 log('DELETE(null): ' + req.getResponseHeader("REQMETHOD") + "(" + req.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req.getResponseHeader("REQTYPE"));
65 req.open("DELETE", "methods.cgi", false);
66 req.send("123");
67 log('DELETE("123"): ' + req.getResponseHeader("REQMETHOD") + "(" + req.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req.getResponseHeader("REQTYPE"));
69 req.open("HEAD", "methods.cgi", false);
70 req.send("");
71 log('HEAD(""): ' + req.getResponseHeader("REQMETHOD") + "(" + req.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req.getResponseHeader("REQTYPE"));
73 req.open("HEAD", "methods.cgi", false);
74 req.send(null);
75 log('HEAD(null): ' + req.getResponseHeader("REQMETHOD") + "(" + req.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req.getResponseHeader("REQTYPE"));
77 req.open("HEAD", "methods.cgi", false);
78 req.send("123");
79 log('HEAD("123"): ' + req.getResponseHeader("REQMETHOD") + "(" + req.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req.getResponseHeader("REQTYPE"));
81 req.open("WKFOOBAR", "methods.cgi", false);
82 req.send("");
83 log('WKFOOBAR(""): ' + req.getResponseHeader("REQMETHOD") + "(" + req.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req.getResponseHeader("REQTYPE"));
85 req.open("WKFOOBAR", "methods.cgi", false);
86 req.send(null);
87 log('WKFOOBAR(null): ' + req.getResponseHeader("REQMETHOD") + "(" + req.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req.getResponseHeader("REQTYPE"));
89 req.open("WKFOOBAR", "methods.cgi", false);
90 req.send("123");
91 log('WKFOOBAR("123"): ' + req.getResponseHeader("REQMETHOD") + "(" + req.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req.getResponseHeader("REQTYPE"));
93 req.open("SEARCH", "methods.cgi", false);
94 req.send("");
95 log('SEARCH(""): ' + req.getResponseHeader("REQMETHOD") + "(" + req.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req.getResponseHeader("REQTYPE"));
97 req.open("SEARCH", "methods.cgi", false);
98 req.send(null);
99 log('SEARCH(null): ' + req.getResponseHeader("REQMETHOD") + "(" + req.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req.getResponseHeader("REQTYPE"));
101 req.open("SEARCH", "methods.cgi", false);
102 req.send("123");
103 log('SEARCH("123"): ' + req.getResponseHeader("REQMETHOD") + "(" + req.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req.getResponseHeader("REQTYPE"));
105 </script>
106 </body>
107 </html>