access-control-response-with-body-sync.htm (790B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Tests body from CORS preflight response and actual response with sync request</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/common/get-host-info.sub.js"></script> 8 </head> 9 <body> 10 <script type="text/javascript"> 11 test(() => { 12 const xhr = new XMLHttpRequest; 13 14 xhr.open("GET", get_host_info().HTTP_REMOTE_ORIGIN+ 15 "/xhr/resources/access-control-allow-with-body.py", false); 16 xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 17 xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); 18 xhr.send(); 19 20 assert_equals(xhr.status, 200); 21 assert_equals(xhr.responseText, "PASS"); 22 }); 23 </script> 24 </body> 25 </html>