summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/xhr/access-control-basic-allow-non-cors-safelisted-method.any.js
blob: f238f0d30561d1157853e583b745378385e5df3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// META: title=Tests cross-origin request with non-CORS-safelisted method
// META: script=/common/get-host-info.sub.js

    test(function() {
      const xhr = new XMLHttpRequest;

      xhr.open("PUT", get_host_info().HTTP_REMOTE_ORIGIN + "/xhr/resources/access-control-basic-put-allow.py", false);

      xhr.setRequestHeader("Content-Type", "text/plain; charset=UTF-8");

      xhr.send("PASS: PUT data received");

      assert_equals(xhr.responseText, "PASS: Cross-domain access allowed.\nPASS: PUT data received");
    }, "Allow PUT request");