<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=40947">bug 40947</a>:
REGRESSION (r57544): XMLHttpRequest POSTed multipart/form-data wrongfully gets a charset appended.</p>
<p>There should be no charset added, and most importantly, it shouldn't be appended to the end.</p>
<script>
if (window.testRunner)
    testRunner.dumpAsText();

var boundary = "----MISFormBoundaryMTCcH1pthhYPYEpV";
var contentType = "multipart/form-data; boundary=" + boundary;
var body = '';
body += '--' + boundary + '\r\n' + 'Content-Disposition: form-data; name="';
body += "data";
body += '"\r\n\r\n';
body += "foobar";
body += '\r\n'
body += '--' + boundary + '--';

var r = new XMLHttpRequest;
r.open("POST", "print-content-type.cgi", false);
r.setRequestHeader("Content-Type", contentType);
r.send(body);
var result = r.responseText.replace(/[\r\n]/g, "");

if (result == contentType)
    document.write("PASS");
else
    document.write("FAIL, Content-Type has been modified. Expected '" + contentType + "', got '" + result + "'.");
</script>
