<html>
<head>
<title>XMLHttpRequest: default mime type when sending Document should be text/html or application/xml according the document type.</title>
</head>
<body>
<script src="/js-test-resources/testharness.js"></script>
<script src="/js-test-resources/testharnessreport.js"></script>
<script>
    test(function() {
        req = new XMLHttpRequest
        req.open("POST", "print-content-type.cgi", false)
        req.send(new DOMParser().parseFromString("&lt;html/&gt;", "text/html"))
        assert_equals(req.responseText.trim(), "text/html;charset=UTF-8")
    }, "sending HTML document should set the Content-Type to text/html;charset=UTF-8.")

    test(function() {
        req = new XMLHttpRequest
        req.open("POST", "print-content-type.cgi", false)
        req.send(new DOMParser().parseFromString("&lt;test/&gt;", "application/xml"))
        assert_equals(req.responseText.trim(), "application/xml;charset=UTF-8", "sending XML document via XMLHttpRequest should set the Content-Type to application/xml;charset=UTF-8.")
    }, "sending XML document should set the Content-Type to application/xml;charset=UTF-8.")
</script>
</body>
</html>

