Re: [whatwg/fetch] Proposal: `Response.json` helper (Issue #1389)

> Is it handy? Obviously yes. Is it good? Probably not.
If Response.json is added, sooner or later we will have to add Response.arrayBuffer, Response.blob, Response.text / Response.string (And maybe some people / companies even want Response.formData).

@SukkaW No need to add those, as those already exist. They are overloads of the `new Response` constructor. Example:

```js
const resp = new Response(new ArrayBuffer(5));
const resp = new Response(new Blob(["hello world"]));
const resp = new Response("foo bar");
const resp = new Response(new FormData());
```

The only reason JSON can't be included in the overload is that the plain object can not be differentiated from other object inputs in a non confusing manner.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/1389#issuecomment-1024889617
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/issues/1389/1024889617@github.com>

Received on Saturday, 29 January 2022 11:04:08 UTC