tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

send-entity-body-get-head.htm (1309B)


      1 <!doctype html>
      2 <html>
      3  <head>
      4    <title>XMLHttpRequest: send() - non-empty data argument and GET/HEAD</title>
      5    <script src="/resources/testharness.js"></script>
      6    <script src="/resources/testharnessreport.js"></script>
      7        <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::OL[1]/LI[3] following::OL[1]/LI[7]" />
      8 
      9  </head>
     10  <body>
     11    <div id="log"></div>
     12    <script>
     13      function request(method) {
     14        test(function() {
     15          var events=[]
     16          var logEvt = function (e) {
     17            events.push(e.type)
     18          }
     19          var client = new XMLHttpRequest()
     20          client.open(method, "resources/content.py", false)
     21          client.send("TEST")
     22          client.upload.addEventListener('progress', logEvt)
     23          client.upload.addEventListener('loadend', logEvt)
     24          client.upload.addEventListener('loadstart', logEvt)
     25 
     26          assert_equals(client.getResponseHeader("x-request-content-length"), "NO")
     27          assert_equals(client.getResponseHeader("x-request-method"), method)
     28          assert_equals(client.responseText, "")
     29          assert_array_equals(events, [])
     30        }, document.title + " (" + method + ")")
     31      }
     32      request("GET")
     33      request("HEAD")
     34    </script>
     35  </body>
     36 </html>