[Webkit-unassigned] [Bug 236582] Response.body is not null for fetch responses with null status codes or HEAD methods

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Feb 14 09:21:07 PST 2022


https://bugs.webkit.org/show_bug.cgi?id=236582

--- Comment #3 from Luca Casonato <hello at lcas.dev> ---
I would not be in favor of standardizing the current behavior unless we also allow `new Response(new ReadableStream({}), {status: 204})`. Otherwise the following does not work:

```js
const resp = await fetch("https://page-that-returns-204");
const resp2 = new Response(resp.body, resp); // resp.body is an empty ReadableStream right now
```

That is a relatively common pattern I have seen in the wild for Deno users.

I don't see why we couldn't standardize that `new Response(null, { status: 204 })` shouldn't create a `Response` with a 0 length `ReadableStream` as `.body`. If we do that though, we should also allow any body for null body status codes, and not limit it to `null` like we do now. I don't expect that anyone relies on either of these behaviors.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220214/4f4a4134/attachment.htm>


More information about the webkit-unassigned mailing list