tor-browser

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

http-accept-header.sub.html (1033B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <title>HTTP Accept header with JSON module requests</title>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 </head>
      8 <body>
      9 <script type="module">
     10  import json from "./http-accept-header-checker.py" with { type: "json"};
     11  test(t => {
     12    assert_equals(
     13        json.accept, "application/json,*/*;q=0.5",
     14        "The HTTP Accept header should be set to 'application/json' when statically importing a JSON module.");
     15  }, "Static import of a JSON module should send a valid HTTP Accept header.");
     16 </script>
     17 
     18 <script type="module">
     19 promise_test(async () => {
     20  const module = await import("./http-accept-header-checker.py", { with: { type: "json"} });
     21  assert_equals(
     22      module.default.accept, "application/json,*/*;q=0.5",
     23      "The HTTP Accept header should be set to 'application/json' when dynamically importing a JSON module.");
     24  }, "Dynamic import of a JSON module should send a valid HTTP Accept header.");
     25 </script>
     26 </body>
     27 </html>