Contact emailsri...@chromium.org, yhir...@chromium.org

Explainer
https://docs.google.com/document/d/1dTycWmyxLZNGTBW93fvtf1IQahx-vNwgu94yT1x9K50/edit

Specificationhttps://fetch.spec.whatwg.org/#ref-for-dom-response-json

Summary

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 componentBlink>Network>FetchAPI
<https://bugs.chromium.org/p/chromium/issues/list?q=component:Blink%3ENetwork%3EFetchAPI>

Motivation

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 proposalhttps://github.com/whatwg/fetch/issues/1389

TAG reviewhttps://github.com/w3ctag/design-reviews/issues/741

TAG review statusPending

Risks


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

*Other signals*:

Ergonomics

This is a convenience function that is purely an ergonomic improvement.


Activation

The feature can be easily polyfilled.


Security

The feature adds no capabilities that developers don't already have. The
implementation mostly reuses existing logic, reducing the security risk.


WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that
it has potentially high risk for Android WebView-based applications?

No


Debuggability

Automatically supported as a feature implemented in WebIDL.


Is this feature fully tested by web-platform-tests
<https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md>
?Yes

Flag name

Requires code in //chrome?False

Tracking bughttps://crbug.com/1305358

Non-OSS dependencies

Does the feature depend on any code or APIs outside the Chromium open
source repository and its open-source dependencies to function?
No

Estimated milestones

No milestones specified


Link to entry on the Chrome Platform Status
https://chromestatus.com/feature/5197912798658560

This intent message was generated by Chrome Platform Status
<https://chromestatus.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+unsubscr...@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.

Reply via email to