Index: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/send-entity-body-charset.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/send-entity-body-charset.html b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/send-entity-body-charset.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4b803086079b2f69432ad716a140795e243320c8 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/send-entity-body-charset.html |
@@ -0,0 +1,28 @@ |
+<!doctype html> |
+<html> |
+ <head> |
+ <title>XMLHttpRequest: send() - data argument</title> |
+ <script src="/resources/testharness.js"></script> |
+ <script src="/resources/testharnessreport.js"></script> |
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="/following::ol/li[4]" /> |
+ </head> |
+ <body> |
+ <div id="log"></div> |
+ <script> |
+ function requestCharset(input, charset, contentType) { |
+ test(function() { |
+ var client = new XMLHttpRequest(); |
+ client.open("POST", "print-content-type.cgi", false); |
+ if (contentType) |
+ client.setRequestHeader("Content-Type", contentType); |
+ client.send(input); |
+ assert_true(client.responseText.indexOf("charset=" + charset) >= 0); |
+ }, document.title + " (" + input + " requested with charset=" + charset + ")") |
+ } |
+ requestCharset(1, "UTF-8"); |
+ requestCharset(1, "UTF-8", "application/javascript;charset=us-ascii"); |
+ requestCharset(new URLSearchParams([[1, 2], [3, 4]]), "UTF-8"); |
+ requestCharset(new URLSearchParams([[1, 2], [3, 4]]), "UTF-8", "text/javascript;charset=us-ascii"); |
+ </script> |
+ </body> |
+</html> |