mirror of
https://github.com/servo/servo.git
synced 2025-08-14 09:55:35 +01:00
Update web-platform-tests to revision b4c87a442f82ff5e1de9a94e735b7b6c5f2e60c5
This commit is contained in:
parent
8a42710915
commit
b506d7413a
114 changed files with 1565 additions and 371 deletions
40
tests/wpt/web-platform-tests/fetch/api/body/mime-type.any.js
Normal file
40
tests/wpt/web-platform-tests/fetch/api/body/mime-type.any.js
Normal file
|
@ -0,0 +1,40 @@
|
|||
[
|
||||
() => new Request("about:blank", { headers: { "Content-Type": "text/plain" } }),
|
||||
() => new Response("", { headers: { "Content-Type": "text/plain" } })
|
||||
].forEach(bodyContainerCreator => {
|
||||
const bodyContainer = bodyContainerCreator();
|
||||
promise_test(async t => {
|
||||
assert_equals(bodyContainer.headers.get("Content-Type"), "text/plain");
|
||||
const newMIMEType = "test/test";
|
||||
bodyContainer.headers.set("Content-Type", newMIMEType);
|
||||
const blob = await bodyContainer.blob();
|
||||
assert_equals(blob.type, newMIMEType);
|
||||
}, `${bodyContainer.constructor.name}: overriding explicit Content-Type`);
|
||||
});
|
||||
|
||||
[
|
||||
() => new Request("about:blank", { body: new URLSearchParams(), method: "POST" }),
|
||||
() => new Response(new URLSearchParams()),
|
||||
].forEach(bodyContainerCreator => {
|
||||
const bodyContainer = bodyContainerCreator();
|
||||
promise_test(async t => {
|
||||
assert_equals(bodyContainer.headers.get("Content-Type"), "application/x-www-form-urlencoded;charset=UTF-8");
|
||||
bodyContainer.headers.delete("Content-Type");
|
||||
const blob = await bodyContainer.blob();
|
||||
assert_equals(blob.type, "");
|
||||
}, `${bodyContainer.constructor.name}: removing implicit Content-Type`);
|
||||
});
|
||||
|
||||
[
|
||||
() => new Request("about:blank", { body: new ArrayBuffer(), method: "POST" }),
|
||||
() => new Response(new ArrayBuffer()),
|
||||
].forEach(bodyContainerCreator => {
|
||||
const bodyContainer = bodyContainerCreator();
|
||||
promise_test(async t => {
|
||||
assert_equals(bodyContainer.headers.get("Content-Type"), null);
|
||||
const newMIMEType = "test/test";
|
||||
bodyContainer.headers.set("Content-Type", newMIMEType);
|
||||
const blob = await bodyContainer.blob();
|
||||
assert_equals(blob.type, newMIMEType);
|
||||
}, `${bodyContainer.constructor.name}: setting missing Content-Type`);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue