| <!doctype html> |
| <html> |
| <head> |
| <title>XMLHttpRequest: setRequestHeader() - combining headers </title> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <link rel="help" href="https://xhr.spec.whatwg.org/#the-setrequestheader()-method" data-tested-assertations="/following::ol/li[6] /following::ol/li[7]" /> |
| </head> |
| <body> |
| <div id="log"></div> |
| <script> |
| function request(header, doNotshowFullValueInError) { |
| test(function() { |
| var client = new XMLHttpRequest() |
| client.open("POST", "resources/print-headers.php", false) |
| client.setRequestHeader(header, "t1") |
| client.setRequestHeader(header, "t2") |
| client.send(null) |
| if (!doNotshowFullValueInError) |
| assert_equals(JSON.parse(client.response)[header.toLowerCase()], "t1,t2", "Combined header value should be t1,t2") |
| else |
| assert_true(JSON.parse(client.response)[header.toLowerCase()] == "t1,t2", "Combined header value should be t1,t2") |
| }, document.title + " (" + header + ")") |
| } |
| request("Authorization") |
| request("Pragma") |
| request("User-Agent", true) |
| request("Content-Transfer-Encoding") |
| request("Content-Type") |
| request("Overwrite") |
| request("If") |
| request("Status-URI") |
| request("X-Pink-Unicorn") |
| </script> |
| </body> |
| </html> |