Revision 8f93a78175a1c98e6d36bd8293ff5525edd0da91 authored by Jonathon Kereliuk on 03 April 2018, 19:12:01 UTC, committed by Philip Jägenstedt on 03 April 2018, 19:12:01 UTC
1 parent 51b2242
response-invalid-responsetype.htm
<!doctype html>
<html>
<head>
<title>XMLHttpRequest: response is plain text if responseType is set to an invalid string</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://xhr.spec.whatwg.org/#the-response-attribute" data-tested-assertations="following::dd[2]/ol[1]/li[2]" />
<link rel="help" href="https://xhr.spec.whatwg.org/#the-responsetype-attribute" data-tested-assertations="following::ol[1]/li[4]" /><!-- Not quite - but this is handled in WebIDL, not the XHR spec -->
</head>
<body>
<div id="log"></div>
<script>
function request(type) {
var test = async_test(document.title+' ('+type+')')
test.step(function() {
var client = new XMLHttpRequest()
client.responseType = type
assert_equals(client.responseType, '')
client.open("GET", "resources/folder.txt", true)
client.onload = function(){
test.step(function(){
assert_equals(client.responseType, '')
assert_equals(client.response, 'bottom\n')
assert_equals(typeof client.response, 'string')
test.done()
})
}
client.send(null)
})
}
request("arrayBuffer") // case sensitive
request("JSON") // case sensitive
request("glob")
request("txt")
request("text/html")
</script>
</body>
</html>
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...