<html>
<head>
    <script src="/js-test-resources/js-test-pre.js"></script>
    <script type="text/javascript">
    description('This test verifies that XMLHttpRequest properly handles list-valued headers.');
    window.jsTestIsAsync = true;

    var xhr;

    if (window.XMLHttpRequest) {
        xhr = new XMLHttpRequest();
    } else {
        try {
            xhr = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (ex) {
            xhr = new ActiveXObject("Microsoft.XMLHTTP");
        }
    }

    xhr.open("GET", "resources/custom-headers.py");
    xhr.send(null);

    xhr.onreadystatechange = function() {
        if(xhr.readyState == 4) {
            shouldBeGreaterThanOrEqual("xhr.getResponseHeader(\"CONTENT-TYPE\").indexOf(\"text/plain\")", "0");
            shouldBeEqualToString("xhr.getResponseHeader(\"x-custom-header-single\")", "single");
            shouldBeEmptyString("xhr.getResponseHeader(\"x-custom-header-empty\")");
            shouldBeEqualToString("xhr.getResponseHeader(\"x-custom-header-list\")", "one, two");
            finishJSTest();
        }
    }

    </script>
    <script src="/js-test-resources/js-test-post.js"></script>
</head>

<body>
</body>
</html>
