Revision 57df86a4eea2924f997f5ca1cb4133b8040f1e32 authored by Simon Pieters on 21 June 2017, 09:23:29 UTC, committed by Simon Pieters on 25 August 2017, 13:14:00 UTC
1 parent 81b3fdb
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 ...