Improves ergonomics for creating JSON Response objects. The Response constructor allows for creating the body of the response from many types, however it is not possible to directly create a JSON object. The Response.json() static method fills this gap. It returns a Response object with a body consisting the first argument serialized as JSON. The second argument is a ResponseInit option bag as with the Response constructor.
Creating a Response object with a body of a JSON object has been harder than the other types supported by Fetch. This change improves the ergonomics of creating a JSON response.
Interoperability risk is low as Deno and Node have already implemented the feature, and it is a simple addition to the API. We know of no compatibility risk. It could happen if someone is using a polyfill with an incompatible API, but that is unlikely.
This is a convenience function that is purely an ergonomic improvement.
The feature can be easily polyfilled.
The feature adds no capabilities that developers don't already have. The implementation mostly reuses existing logic, reducing the security risk.
Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?
No
Automatically supported as a feature implemented in WebIDL.
Does the feature depend on any code or APIs outside the Chromium open source repository and its open-source dependencies to function?
NoNo milestones specified
Contact emails
ri...@chromium.org, yhi...@chromium.orgExplainer
https://docs.google.com/document/d/1dTycWmyxLZNGTBW93fvtf1IQahx-vNwgu94yT1x9K50/editSpecification
https://fetch.spec.whatwg.org/#ref-for-dom-response-jsonSummary
Improves ergonomics for creating JSON Response objects. The Response constructor allows for creating the body of the response from many types, however it is not possible to directly create a JSON object. The Response.json() static method fills this gap. It returns a Response object with a body consisting the first argument serialized as JSON. The second argument is a ResponseInit option bag as with the Response constructor.
Blink component
Blink>Network>FetchAPIMotivation
Creating a Response object with a body of a JSON object has been harder than the other types supported by Fetch. This change improves the ergonomics of creating a JSON response.
Initial public proposal
https://github.com/whatwg/fetch/issues/1389TAG review
https://github.com/w3ctag/design-reviews/issues/741
TAG review status
PendingRisks
Interoperability and Compatibility
Interoperability risk is low as Deno and Node have already implemented the feature, and it is a simple addition to the API. We know of no compatibility risk. It could happen if someone is using a polyfill with an incompatible API, but that is unlikely.
Gecko: Worth prototyping (https://github.com/mozilla/standards-positions/issues/640)
WebKit: Positive (https://lists.webkit.org/pipermail/webkit-dev/2022-May/032254.html)
Web developers: Positive (https://github.com/whatwg/fetch/issues/1389) Example positive feedback: https://github.com/whatwg/fetch/issues/1389#issuecomment-1024726318 Example negative feedback: https://github.com/whatwg/fetch/issues/1389#issuecomment-1024880489
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAC_ixdx%3DCG59iJ68vnOtRJC5ZCVK%2B4jing0n83HhkX2Kze%3DJiQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAL5BFfVbMSWhXta14OUxXSNxy3eGO0jGxfzuKjT9edHPVpb-FQ%40mail.gmail.com.
LGTM1On Tue, May 31, 2022 at 11:08 PM Yoav Weiss <yoav...@chromium.org> wrote:
On Tue, May 31, 2022 at 4:08 AM Adam Rice <ri...@chromium.org> wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAC_ixdx%3DCG59iJ68vnOtRJC5ZCVK%2B4jing0n83HhkX2Kze%3DJiQ%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
LGTM2
On Wednesday, June 22, 2022 at 5:53:49 PM UTC+2 Chris Harrelson wrote:
LGTM1On Tue, May 31, 2022 at 11:08 PM Yoav Weiss <yoav...@chromium.org> wrote:
On Tue, May 31, 2022 at 4:08 AM Adam Rice <ri...@chromium.org> wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAC_ixdx%3DCG59iJ68vnOtRJC5ZCVK%2B4jing0n83HhkX2Kze%3DJiQ%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAL5BFfVbMSWhXta14OUxXSNxy3eGO0jGxfzuKjT9edHPVpb-FQ%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/d247eeaf-f3be-438f-b1f3-5ab6ee6e4594n%40chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAARdPYejeFEVPSPzSEexrEAdYKjWg8q9aNDU6vVGLmrSF42tpw%40mail.gmail.com.