<!DOCTYPE html>
<html>
<head>
<script src="../../js-test-resources/js-test-pre.js"></script>
</head>
<body>
<script type="text/javascript">
description("Allow lists starting with a comma should be parsed correctly.");
var xhr = new XMLHttpRequest();
var url = "http://localhost:8000/xmlhttprequest/resources/access-control-allow-lists.py?headers=,y-lol,x-print,%20,,,y-print&origin=http://127.0.0.1:8000";
xhr.open("GET", url, false);
xhr.setRequestHeader('x-print', 'unicorn')
xhr.setRequestHeader('y-print', 'narwhal')
debug("Sending GET request with custom headers.");
shouldBeUndefined("xhr.send(null)");
var response = JSON.parse(xhr.response)
shouldBeEqualToString("response['x-print']", "unicorn");
shouldBeEqualToString("response['y-print']", "narwhal");

url = "http://localhost:8000/xmlhttprequest/resources/access-control-allow-lists.py?methods=,,PUT,GET&origin=http://127.0.0.1:8000";
xhr.open("PUT", url, false);
debug("Sending PUT request.");
shouldBeUndefined("xhr.send(null)");
</script>
<script src="../../js-test-resources/js-test-post.js"></script>
</body>
</html>
