Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / xmlhttprequest / access-control-allow-lists-starting-with-comma.html
blob90967e27aa1903fcdf2c7b7f19b2124cfe693369
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../js-test-resources/js-test.js"></script>
5 </head>
6 <body>
7 <script type="text/javascript">
8 description("Allow lists starting with a comma should be parsed correctly.");
9 var xhr = new XMLHttpRequest();
10 var url = "http://localhost:8000/xmlhttprequest/resources/access-control-allow-lists.php?headers=,y-lol,x-print,%20,,,y-print&origin=http://127.0.0.1:8000";
11 xhr.open("GET", url, false);
12 xhr.setRequestHeader('x-print', 'unicorn')
13 xhr.setRequestHeader('y-print', 'narwhal')
14 debug("Sending GET request with custom headers.");
15 shouldBeUndefined("xhr.send(null)");
16 var response = JSON.parse(xhr.response)
17 shouldBeEqualToString("response['x-print']", "unicorn");
18 shouldBeEqualToString("response['y-print']", "narwhal");
20 url = "http://localhost:8000/xmlhttprequest/resources/access-control-allow-lists.php?methods=,,PUT,GET&origin=http://127.0.0.1:8000";
21 xhr.open("PUT", url, false);
22 debug("Sending PUT request.");
23 shouldBeUndefined("xhr.send(null)");
24 </script>
25 </body>
26 </html>