OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <title>XMLHttpRequest: send() - data argument</title> |
| 5 <script src="/resources/testharness.js"></script> |
| 6 <script src="/resources/testharnessreport.js"></script> |
| 7 <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-
tested-assertations="/following::ol/li[4]" /> |
| 8 </head> |
| 9 <body> |
| 10 <div id="log"></div> |
| 11 <script> |
| 12 function requestCharset(input, charset, contentType) { |
| 13 test(function() { |
| 14 var client = new XMLHttpRequest(); |
| 15 client.open("POST", "print-content-type.cgi", false); |
| 16 if (contentType) |
| 17 client.setRequestHeader("Content-Type", contentType); |
| 18 client.send(input); |
| 19 assert_true(client.responseText.indexOf("charset=" + charset) >= 0); |
| 20 }, document.title + " (" + input + " requested with charset=" + charset
+ ")") |
| 21 } |
| 22 requestCharset(1, "UTF-8"); |
| 23 requestCharset(1, "UTF-8", "application/javascript;charset=us-ascii"); |
| 24 requestCharset(new URLSearchParams([[1, 2], [3, 4]]), "UTF-8"); |
| 25 requestCharset(new URLSearchParams([[1, 2], [3, 4]]), "UTF-8", "text/javas
cript;charset=us-ascii"); |
| 26 </script> |
| 27 </body> |
| 28 </html> |
OLD | NEW |