blob: cd11e334a0f36d2b1deafbc892613d8a3e93a7b9 [file] [log] [blame]
Anne van Kesteren66b54172010-08-11 18:02:171<!doctype html>
2<html>
3 <head>
4 <title>XMLHttpRequest: setRequestHeader() - headers that are allowed</title>
5 <script src="/resources/testharness.js"></script>
Ms2ger6f083e72012-08-05 08:38:146 <script src="/resources/testharnessreport.js"></script>
Anne van Kesterenc2812422017-03-07 09:00:377 <link rel="help" href="https://xhr.spec.whatwg.org/#the-setrequestheader()-method">
Anne van Kesteren66b54172010-08-11 18:02:178 </head>
9 <body>
10 <div id="log"></div>
11 <script>
12 function request(header) {
13 test(function() {
14 var client = new XMLHttpRequest()
Anne van Kesterenc2812422017-03-07 09:00:3715 client.open("POST", "resources/inspect-headers.py?filter_value=t1, t2", false)
Anne van Kesteren66b54172010-08-11 18:02:1716 client.setRequestHeader(header, "t1")
17 client.setRequestHeader(header, "t2")
18 client.send(null)
Anne van Kesterenc2812422017-03-07 09:00:3719 assert_equals(client.responseText, header + ",")
Anne van Kesteren66b54172010-08-11 18:02:1720 }, document.title + " (" + header + ")")
21 }
22 request("Authorization")
23 request("Pragma")
Hallvord Reiar M. Steend3c0c632015-08-27 12:20:0024 request("User-Agent")
Hallvord R. M. Steen6bb53052012-11-09 10:47:4925 request("Content-Transfer-Encoding")
Anne van Kesteren66b54172010-08-11 18:02:1726 request("Content-Type")
27 request("Overwrite")
28 request("If")
29 request("Status-URI")
30 request("X-Pink-Unicorn")
31 </script>
32 </body>
33</html>