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

@andreubotella commented on this pull request.



> + object, given a new <a for=/>response</a>, "<code>response</code>", and <a>this</a>'s
+ <a>relevant Realm</a>.
+
+ <li><p>Set <var>responseObject</var>'s <a for=Response>response</a>'s <a for=response>status</a> to
+ <var>init</var>["{{ResponseInit/status}}"].
+
+ <li><p>Set <var>responseObject</var>'s <a for=Response>response</a>'s
+ <a for=response>status message</a> to <var>init</var>["{{ResponseInit/statusText}}"].
+
+ <li><p>If <var>init</var>["{{ResponseInit/headers}}"] <a for=map>exists</a>, then
+ <a for=Headers>fill</a> <var>responseObject</var>'s <a for=Response>headers</a> with
+ <var>init</var>["{{ResponseInit/headers}}"].
+
+ <li><p>Set <var>responseObject</var>'s <a for=Response>response</a>'s <a for=response>body</a> to
+ the <a>UTF-8 encoding</a> of the result of running
+ <a>serialize a JavaScript value to a JSON string</a> on <var>data</var>.

Infra has a ["serialize a JavaScript value to JSON bytes"](https://infra.spec.whatwg.org/#serialize-a-javascript-value-to-json-bytes) algorithm.

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

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

Received on Sunday, 30 January 2022 19:32:11 UTC