Re: [whatwg/fetch] Add `Response.json` static method (PR #1392)

@annevk commented on this pull request.

Yeah this is reasonable and small enough. Mozilla supports this.

cc @KershawChang

> +<p>The static
+<dfn method for=Response><code>json(<var>data</var>, <var>init</var>)</code></dfn> method steps
+are:
+
+<ol>
+ <li><p>Let <var>bytes</var> the result of running <a>serialize a JavaScript value to JSON bytes</a>
+ on <var>data</var>.
+
+ <li><p>Let <var>body</var> be the result of <a for=BodyInit>extracting</a> <var>bytes</var>.
+
+ <li><p>Let <var>responseObject</var> be the result of <a for=Response>creating</a> a {{Response}}
+ object, given a new <a for=/>response</a>, "<code>response</code>", and <a>this</a>'s
+ <a>relevant Realm</a>.
+
+ <li><p>Perform <a>initialize a response</a> given <var>responseObject</var>, <var>init</var>, and
+ (body, <code>"application/json;charset=UTF-8"</code>).

The quotation marks need to be on the outside.

But also, I think we don't want a `charset` parameter here. None is defined for this MIME type.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1392#pullrequestreview-970555855
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/pull/1392/review/970555855@github.com>

Received on Thursday, 12 May 2022 09:38:00 UTC