<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<script src="/js-test-resources/js-test-pre.js"></script>
<script>
    description('This test verifies that XMLHttpRequest properly handles Content-Type when it is reused.');
    if (window.testRunner)
        testRunner.dumpAsText();

    var req = new XMLHttpRequest;
    try {
        req.open("GET", "resources/get-utf-8.cgi", false);
        req.send();
        shouldBeEqualToString("req.getResponseHeader('Content-Type')", "text/plain; charset=utf-8");
        shouldBeEqualToString("req.responseText", "Проверка");
        req.open("GET", "resources/get-windows-1251.cgi", false);
        req.send();
        shouldBeEqualToString("req.getResponseHeader('Content-Type')", "text/plain; charset=windows-1251");
        shouldBeEqualToString("req.responseText", "Проверка");
        finishJSTest();
    } catch (ex) {
        fail("an exception is thrown: " + ex);
    }
</script>
<script src="/js-test-resources/js-test-post.js"></script>
</body>
</html>
