| <!doctype html> |
| <title>Casing of known headers</title> |
| <script src=/resources/testharness.js></script> |
| <script src=/resources/testharnessreport.js></script> |
| <script> |
| test(() => { |
| const client = new XMLHttpRequest |
| client.open("GET", "resources/header-content-length.asis", false) |
| client.send() |
| assert_equals(client.getAllResponseHeaders(), "content-length: 0\r\n") |
| }) |
| test(() => { |
| const client = new XMLHttpRequest |
| client.open("GET", "resources/echo-headers.py", false) |
| client.setRequestHeader("THIS-IS-A-TEST", "1") |
| client.setRequestHeader("THIS-is-A-test", "2") |
| client.setRequestHeader("content-TYPE", "x/x") |
| client.send() |
| assert_regexp_match(client.responseText, /content-TYPE/) |
| assert_regexp_match(client.responseText, /THIS-IS-A-TEST: 1, 2/) |
| }) |
| promise_test(() => { |
| return fetch("resources/echo-headers.py", {headers: [["THIS-is-A-test", 1], ["THIS-IS-A-TEST", 2]] }).then(res => res.text()).then(body => { |
| assert_regexp_match(body, /THIS-is-A-test: 1, 2/) |
| }) |
| }) |
| </script> |