Update web-platform-tests to revision b'468d01bbd84da2babf265c6af46947be68713440'

This commit is contained in:
WPT Sync Bot 2021-09-07 11:16:33 +00:00 committed by cybai
parent 35e95f55a1
commit 58e8ee674b
9438 changed files with 266112 additions and 106976 deletions

View file

@ -4,7 +4,7 @@
// META: script=/common/get-host-info.sub.js
function testUpload(desc, url, method, createBody, expectedBody) {
const requestInit = {"method": method}
const requestInit = {method};
promise_test(function(test){
const body = createBody();
if (body) {
@ -19,7 +19,7 @@ function testUpload(desc, url, method, createBody, expectedBody) {
}
function testUploadFailure(desc, url, method, createBody) {
const requestInit = {"method": method};
const requestInit = {method};
promise_test(t => {
const body = createBody();
if (body) {
@ -75,16 +75,7 @@ testUpload("Fetch with POST with Blob body with mime type", url,
"POST",
() => new Blob(["Test"], { type: "text/maybe" }),
"Test");
testUpload("Fetch with POST with ReadableStream", url,
"POST",
() => {
return new ReadableStream({start: controller => {
const encoder = new TextEncoder();
controller.enqueue(encoder.encode("Test"));
controller.close();
}})
},
"Test");
testUploadFailure("Fetch with POST with ReadableStream containing String", url,
"POST",
() => {
@ -152,3 +143,30 @@ promise_test(async (test) => {
const text = await resp.text();
assert_equals(text, "ok. Request was sent 1 times. 1 connections were created.");
}, "Fetch with POST with ReadableStream on 421 response should return the response and not retry.");
promise_test(async (test) => {
const request = new Request('', {
body: new ReadableStream(),
method: 'POST',
});
assert_equals(request.headers.get('Content-Type'), null, `Request should not have a content-type set`);
const response = await fetch('data:a/a;charset=utf-8,test', {
method: 'POST',
body: new ReadableStream(),
});
assert_equals(await response.text(), 'test', `Response has correct body`);
}, "Feature detect for POST with ReadableStream");
promise_test(async (test) => {
const request = new Request('data:a/a;charset=utf-8,test', {
body: new ReadableStream(),
method: 'POST',
});
assert_equals(request.headers.get('Content-Type'), null, `Request should not have a content-type set`);
const response = await fetch(request);
assert_equals(await response.text(), 'test', `Response has correct body`);
}, "Feature detect for POST with ReadableStream, using request object");