diff options
-rw-r--r-- | extensions/fetch/26_fetch.js | 23 | ||||
-rw-r--r-- | tools/wpt/expectation.json | 13 |
2 files changed, 21 insertions, 15 deletions
diff --git a/extensions/fetch/26_fetch.js b/extensions/fetch/26_fetch.js index cf336f7a5..d1fd1e9b3 100644 --- a/extensions/fetch/26_fetch.js +++ b/extensions/fetch/26_fetch.js @@ -148,6 +148,7 @@ async function mainFetch(req, recursive, terminator) { /** @type {ReadableStream<Uint8Array> | Uint8Array | null} */ let reqBody = null; + if (req.body !== null) { if (req.body.streamOrStatic instanceof ReadableStream) { if (req.body.length === null) { @@ -269,9 +270,14 @@ if (nullBodyStatus(response.status)) { core.close(resp.responseRid); } else { - response.body = new InnerBody( - createResponseBodyStream(resp.responseRid, terminator), - ); + if (req.method === "HEAD" || req.method === "OPTIONS") { + response.body = null; + core.close(resp.responseRid); + } else { + response.body = new InnerBody( + createResponseBodyStream(resp.responseRid, terminator), + ); + } } if (recursive) return response; @@ -289,8 +295,9 @@ * @returns {Promise<InnerResponse>} */ function httpRedirectFetch(request, response, terminator) { - const locationHeaders = response.headerList - .filter((entry) => entry[0] === "location"); + const locationHeaders = response.headerList.filter( + (entry) => entry[0] === "location", + ); if (locationHeaders.length === 0) { return response; } @@ -309,7 +316,8 @@ } request.redirectCount++; if ( - response.status !== 303 && request.body !== null && + response.status !== 303 && + request.body !== null && request.body.source === null ) { return networkError( @@ -320,7 +328,8 @@ ((response.status === 301 || response.status === 302) && request.method === "POST") || (response.status === 303 && - (request.method !== "GET" && request.method !== "HEAD")) + request.method !== "GET" && + request.method !== "HEAD") ) { request.method = "GET"; request.body = null; diff --git a/tools/wpt/expectation.json b/tools/wpt/expectation.json index 54e8fe7d0..0001f92d3 100644 --- a/tools/wpt/expectation.json +++ b/tools/wpt/expectation.json @@ -234,9 +234,7 @@ }, "hr-time": { "monotonic-clock.any.html": true, - "basic.any.html": [ - "Performance interface extends EventTarget." - ], + "basic.any.html": ["Performance interface extends EventTarget."], "idlharness.any.html": [ "Performance interface: existence and properties of interface object", "Performance interface: existence and properties of interface prototype object", @@ -248,7 +246,8 @@ "Performance interface: performance must inherit property \"toJSON()\" with the proper type", "Performance interface: default toJSON operation on performance", "Window interface: attribute performance" - ] + ], + "window-worker-timeOrigin.window.html": false }, "streams": { "idlharness.any.html": [ @@ -765,9 +764,7 @@ "response-url.sub.any.html": true, "scheme-about.any.html": true, "scheme-blob.sub.any.html": true, - "scheme-data.any.html": [ - "Fetching [HEAD] data:,response%27s%20body is OK" - ], + "scheme-data.any.html": true, "scheme-others.sub.any.html": true, "stream-response.any.html": true, "stream-safe-creation.any.html": [ @@ -1027,4 +1024,4 @@ "set.any.html": true } } -}
\ No newline at end of file +} |