diff options
Diffstat (limited to 'testing/web-platform/tests/cors/client-hint-request-headers-2.tentative.htm')
-rw-r--r-- | testing/web-platform/tests/cors/client-hint-request-headers-2.tentative.htm | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/testing/web-platform/tests/cors/client-hint-request-headers-2.tentative.htm b/testing/web-platform/tests/cors/client-hint-request-headers-2.tentative.htm new file mode 100644 index 0000000000..f7ec3dc6d1 --- /dev/null +++ b/testing/web-platform/tests/cors/client-hint-request-headers-2.tentative.htm @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<meta charset=utf-8> +<title>CORS and Client Hints, potentially</title> + +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script src=support.js?pipe=sub></script> + +<h1>Request headers</h1> +<div id=log></div> +<script> + +test(function() { + var client = new XMLHttpRequest() + client.open('GET', CROSSDOMAIN + 'resources/cors-makeheader.py?headers=x-print,', false) + client.setRequestHeader('x-print', 'unicorn') + client.setRequestHeader('content-type', 'text/plain') + client.setRequestHeader('accept', 'test') + client.setRequestHeader('accept-language', 'nn') + client.setRequestHeader('content-language', 'nn') + client.setRequestHeader('save-data', 'on') + client.setRequestHeader('device-memory', '1.0') + client.setRequestHeader('dpr', '2.0') + client.setRequestHeader('width', '35') + client.setRequestHeader('viewport-width', '42') + client.setRequestHeader('rtt', '1') + client.setRequestHeader('downlink', '1.0') + client.setRequestHeader('ect', '2g') + client.send(null) + + const res = JSON.parse(client.response) + assert_equals(res['x-print'], 'unicorn') + assert_equals(res['content-type'], 'text/plain') + assert_equals(res['accept'], 'test') + assert_equals(res['accept-language'], 'nn') + assert_equals(res['content-language'], 'nn') + assert_equals(res['save-data'], 'on') + assert_equals(res['device-memory'], '1.0') + assert_equals(res['dpr'], '2.0') + assert_equals(res['width'], '35') + assert_equals(res['viewport-width'], '42') + assert_equals(res['rtt'], '1') + assert_equals(res['downlink'], '1.0') + assert_equals(res['ect'], '2g') +}, 'Client hint headers are simple headers') + +</script> |