mirror of
https://github.com/servo/servo.git
synced 2025-08-11 16:35:33 +01:00
Update web-platform-tests to revision 66c4613f823c4384c78ada77346eda17bb128947
This commit is contained in:
parent
183772583f
commit
a91433f0c8
234 changed files with 4368 additions and 967 deletions
|
@ -23,18 +23,23 @@
|
|||
}
|
||||
}, "Initialize Request with headers values");
|
||||
|
||||
function makeRequestInit(body, method) {
|
||||
return {"method": method, "body": body};
|
||||
}
|
||||
|
||||
function checkRequestInit(body, bodyType, expectedTextBody) {
|
||||
promise_test(function(test) {
|
||||
var request = new Request("", {"method": "POST", "body": body});
|
||||
assert_throws(new TypeError(),
|
||||
function() { new Request("", {"method": "GET", "body": body}); }
|
||||
);
|
||||
assert_throws(new TypeError(),
|
||||
function() { new Request("", {"method": "HEAD", "body": body}); }
|
||||
);
|
||||
var request = new Request("", makeRequestInit(body, "POST"));
|
||||
if (body) {
|
||||
assert_throws(new TypeError(),
|
||||
function() { new Request("", makeRequestInit(body, "GET")); }
|
||||
);
|
||||
} else {
|
||||
new Request("", makeRequestInit(body, "GET")); // should not throw
|
||||
}
|
||||
var reqHeaders = request.headers;
|
||||
var mime = reqHeaders.get("Content-Type");
|
||||
assert_true(mime && mime.search(bodyType) > -1, "Content-Type header should be \"" + bodyType + "\", not \"" + mime + "\"");
|
||||
assert_true(!body || (mime && mime.search(bodyType) > -1), "Content-Type header should be \"" + bodyType + "\", not \"" + mime + "\"");
|
||||
return request.text().then(function(bodyAsText) {
|
||||
//not equals: cannot guess formData exact value
|
||||
assert_true( bodyAsText.search(expectedTextBody) > -1, "Retrieve and verify request body");
|
||||
|
@ -47,6 +52,8 @@
|
|||
formaData.append("name", "value");
|
||||
var usvString = "This is a USVString"
|
||||
|
||||
checkRequestInit(undefined, undefined, "");
|
||||
checkRequestInit(null, null, "");
|
||||
checkRequestInit(blob, "application/octet-binary", "This is a blob");
|
||||
checkRequestInit(formaData, "multipart/form-data", "name=\"name\"\r\n\r\nvalue");
|
||||
checkRequestInit(usvString, "text/plain;charset=UTF-8", "This is a USVString");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue