| <!DOCTYPE html> |
| <html> |
| <head> |
| <title>XMLHttpRequest: setRequestHeader() - header value with whitespace</title> |
| <script src="/js-test-resources/testharness.js"></script> |
| <script src="/js-test-resources/testharnessreport.js"></script> |
| <link rel="help" href="https://xhr.spec.whatwg.org/#the-setrequestheader()-method" data-tested-assertations="/following::ol/li[4]/p[contains(@class,'note')] /following::ol/li[6]" /> |
| </head> |
| <body> |
| <!-- This is an adaptation of https://github.com/w3c/web-platform-tests/blob/4f91feb51adfdbfd150743bb3b94744b13b1edae/XMLHttpRequest/setrequestheader-allow-whitespace-in-value.htm --> |
| <div id="log"></div> |
| <script> |
| function request(value) { |
| test(function() { |
| var client = new XMLHttpRequest() |
| client.open("POST", "resources/print-xtest-header.cgi", false) |
| client.setRequestHeader("X-Test", value) |
| client.send(null) |
| assert_equals(client.responseText, "x-test: " + String(value.trim()).toLowerCase() + "\n" ) |
| }, document.title + " (" + value + ")") |
| } |
| request(" ") |
| request(" t") |
| request("t ") |
| request(" t ") |
| </script> |
| </body> |
| </html> |