Mozilla/mozilla/content/base/test/test_bug397234.html
bzbarsky%mit.edu 434a951333 Add a way to extract the charset and the position of the charset parameter from
a content-type header.  Use this in XMLHttpRequest to not clobber the
non-charset parameters and not clobber the charset if it's already what we'll
set, up to case.  Apparently some broken servers are case-sensitive when
looking at charsets!  Bug 393968 (wherein the patch lies) and bug 397234,
r+sr=biesi


git-svn-id: svn://10.0.0.236/trunk@240347 18797224-902f-48f8-a5cc-f745e15eee43
2007-12-03 21:34:45 +00:00

40 lines
1.1 KiB
HTML

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=397234
-->
<head>
<title>Test for Bug 397234</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=397234">Mozilla Bug 397234</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 397234 **/
var req = new XMLHttpRequest();
req.open("POST", window.location.href);
// Capitalization of charet param is on purpose!
req.setRequestHeader("Content-Type", "text/plain; charset='uTf-8'");
req.send("Some text");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
is(req.channel
.QueryInterface(Components.interfaces.nsIHttpChannel)
.getRequestHeader("Content-Type"),
"text/plain; charset='uTf-8'",
"Headers should match");
</script>
</pre>
</body>
</html>