access-control-preflight-request-allow-headers-returns-star.any.js (657B)
1 // META: title=Access-Control-Allow-Headers supports * 2 // META: script=/common/get-host-info.sub.js 3 "use strict"; 4 5 async_test(t => { 6 const xhr = new XMLHttpRequest(); 7 8 xhr.open("GET", corsURL("resources/access-control-preflight-request-allow-headers-returns-star.py")); 9 10 xhr.setRequestHeader("X-Test", "foobar"); 11 12 xhr.onerror = t.unreached_func("Error occurred."); 13 14 xhr.onload = t.step_func_done(() => { 15 assert_equals(xhr.status, 200); 16 assert_equals(xhr.responseText, "PASS"); 17 }); 18 19 xhr.send(); 20 }); 21 22 function corsURL(path) { 23 const url = new URL(path, location.href); 24 url.hostname = get_host_info().REMOTE_HOST; 25 return url.href; 26 }