blob: fe77412deb2e8520c26dc362dff87da9d5a04649 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>XMLHttpRequest: getting response with funny characters</title>
<script src="/js-test-resources/testharness.js"></script>
<script src="/js-test-resources/testharnessreport.js"></script>
<!-- test file originating from W3C web platform test suite -->
</head>
<body>
<div id="log"></div>
<script>
function run_test(name, setupFunction, assertFunction)
{
var test = async_test(name)
test.isAsserted = false
test.step(function() {
var client = new XMLHttpRequest()
client.onreadystatechange = function() {
test.step(function() {
if(client.readyState == 4) {
test.isAsserted = true
assertFunction(client)
}
})
}
client.onloadend = function() {
assert_true(test.isAsserted)
test.done()
}
setupFunction(client)
client.send(null)
})
}
run_test("non ascii response header value",
function(client){
client.open("GET", "resources/headers.php")
},function(client){
assert_equals(client.getResponseHeader("x-custom-header-bytes"), "\xE2\x80\xA6")
}
)
run_test("non ascii statusText",
function(client){
client.open("GET", "resources/not-ascii-status.php")
},function(client){
assert_equals(client.statusText, "OK\xE2\x80\xA6")
}
)
</script>
</body>
</html>