allow-lists-starting-with-comma.htm (1412B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Allow lists starting with a comma should be parsed correctly</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 async_test(function(test) { 12 const client = new XMLHttpRequest(); 13 let url = "xhr/resources/access-control-allow-lists.py?headers=,y-lol,x-print,%20,,,y-print&origin=" + 14 get_host_info().HTTP_ORIGIN; 15 client.open("GET", get_host_info().HTTP_REMOTE_ORIGIN + '/' + url, false); 16 client.setRequestHeader('x-print', 'unicorn') 17 client.setRequestHeader('y-print', 'narwhal') 18 // Sending GET request with custom headers 19 assert_equals(client.send(null), undefined); 20 const response = JSON.parse(client.response); 21 assert_equals(response['x-print'], "unicorn"); 22 assert_equals(response['y-print'], "narwhal"); 23 24 url = "xhr/resources/access-control-allow-lists.py?methods=,,PUT,GET&origin=" + 25 get_host_info().HTTP_ORIGIN; 26 client.open("PUT", get_host_info().HTTP_REMOTE_ORIGIN + '/' + url, false); 27 // Sending PUT request 28 assert_equals(client.send(null), undefined); 29 test.done(); 30 }, "Allow lists starting with a comma should be parsed correctly"); 31 </script> 32 </body> 33 </html>