tor-browser

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

send-entity-body-empty.htm (1243B)


      1 <!doctype html>
      2 <html>
      3  <head>
      4    <title>XMLHttpRequest: send("") - empty entity body</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[7]" />
      8    <link rel="help" href="https://xhr.spec.whatwg.org/#dom-XMLHttpRequest-send-a-string" data-tested-assertations="following::p[1] following::p[2] following::p[3]" />
      9  </head>
     10  <body>
     11    <div id="log"></div>
     12    <script>
     13      function request(method) {
     14        var client = new XMLHttpRequest()
     15        client.open(method, "resources/content.py", false)
     16        client.upload.onloadstart = function(){assert_unreached('this event should not fire for empty strings')}
     17        client.send("")
     18        var expectedLength = method == "HEAD" ? "NO" : "0";
     19        assert_equals(client.getResponseHeader("x-request-content-length"), expectedLength)
     20      }
     21      test(function() { request("POST"); }, document.title + " (POST)");
     22      test(function() { request("PUT"); }, document.title + " (PUT)");
     23      test(function() { request("HEAD"); }, document.title + " (HEAD)");
     24    </script>
     25  </body>
     26 </html>