testing/web-platform/tests/xhr/setrequestheader-header-allowed.htm
author Anne van Kesteren <annevk@annevk.nl>
Tue, 16 Oct 2018 09:58:47 +0000
changeset 489923 889615275c32ec0a7fa79b4fd2daa3423165dcdf
parent 446041 fa40c16f194c89b4db36c1495a33f0a62c32dfb0
child 489935 09dd66ffc95aff0d95312717a450fd85e803eb35
permissions -rw-r--r--
Bug 1499017 [wpt PR 13517] - XHR: test unusual header name syntax, a=testonly Automatic update from web-platform-testsXHR: test unusual header name syntax For https://github.com/httpwg/http-core/issues/30. -- wpt-commits: b3e1de8dc92db9c4f400e622c9ff1582566d61fa wpt-pr: 13517

<!doctype html>
<html>
  <head>
    <title>XMLHttpRequest: setRequestHeader() - headers that are allowed</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">
  </head>
  <body>
    <div id="log"></div>
    <script>
      function request(header) {
        test(function() {
          var client = new XMLHttpRequest()
          client.open("POST", "resources/inspect-headers.py?filter_value=t1, t2", false)
          client.setRequestHeader(header, "t1")
          client.setRequestHeader(header, "t2")
          client.send(null)
          assert_equals(client.responseText, header + ",")
        }, document.title + " (" + header + ")")
      }
      request("Authorization")
      request("Pragma")
      request("User-Agent")
      request("Content-Transfer-Encoding")
      request("Content-Type")
      request("Overwrite")
      request("If")
      request("Status-URI")
      request("X-Pink-Unicorn")
      request("!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyz")
    </script>
  </body>
</html>