mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Update web-platform-tests to revision dc5cbf088edcdb266541d4e5a76149a2c6e716a0
This commit is contained in:
parent
1d40075f03
commit
079092dfea
2381 changed files with 90360 additions and 17722 deletions
|
@ -9,24 +9,32 @@
|
|||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
function noContentTypeTest(method) {
|
||||
var client = new XMLHttpRequest()
|
||||
client.open("POST", "resources/content.py", false)
|
||||
client.open(method, "resources/content.py", false)
|
||||
client.upload.onloadstart = function(){assert_unreached('this event should not fire for null')}
|
||||
client.send(null)
|
||||
assert_equals(client.getResponseHeader("x-request-content-length"), "0")
|
||||
var expectedLength = method == "HEAD" ? "NO" : "0";
|
||||
assert_equals(client.getResponseHeader("x-request-content-length"), expectedLength)
|
||||
assert_equals(client.getResponseHeader("x-request-content-type"), "NO")
|
||||
}, "No content type")
|
||||
}
|
||||
test(function() { noContentTypeTest("POST"); }, "No content type (POST)");
|
||||
test(function() { noContentTypeTest("PUT"); }, "No content type (PUT)");
|
||||
test(function() { noContentTypeTest("HEAD"); }, "No content type (HEAD)");
|
||||
|
||||
test(function() {
|
||||
function explicitContentTypeTest(method) {
|
||||
var client = new XMLHttpRequest()
|
||||
client.open("POST", "resources/content.py", false)
|
||||
client.open(method, "resources/content.py", false)
|
||||
var content_type = 'application/x-foo'
|
||||
client.setRequestHeader('Content-Type', content_type)
|
||||
client.send(null)
|
||||
assert_equals(client.getResponseHeader("x-request-content-length"), "0")
|
||||
var expectedLength = method == "HEAD" ? "NO" : "0";
|
||||
assert_equals(client.getResponseHeader("x-request-content-length"), expectedLength)
|
||||
assert_equals(client.getResponseHeader("x-request-content-type"), content_type)
|
||||
}, "Explicit content type")
|
||||
}
|
||||
test(function() { explicitContentTypeTest("POST"); }, "Explicit content type (POST)");
|
||||
test(function() { explicitContentTypeTest("PUT"); }, "Explicit content type (PUT)");
|
||||
test(function() { explicitContentTypeTest("HEAD"); }, "Explicit content type (HEAD)");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue