- From: Luca Casonato <notifications@github.com>
- Date: Sun, 30 Jan 2022 09:59:02 -0800
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/fetch/pull/1392@github.com>
This commit adds a `Response.json` static method that can be used to
create well formed JSON responses will very little effort.
There are still some open questions:
- **Should the JSON be minified or pretty printed?** Precedent in web platform APIs would say minified (e.g. WebCrypto JWK serialization), but the wider ecosystem usually prefers 2 space pretty printing (e.g. https://api.github.com).
- **Does the name conflict with the `Body.json` prototype method?** If so, let's rename to `Response.fromJSON` (naming style follows [`Array.fromAsync`](https://github.com/tc39/proposal-array-from-async)).
- Are browsers interested (and if they are not, will they implement this)?
Closes #1389
---
- [ ] At least two implementers are interested (and none opposed):
* Deno
* Cloudflare Workers
- [ ] [Tests](https://github.com/web-platform-tests/wpt) are written and can be reviewed and commented upon at:
* (coming soon)
- [ ] [Implementation bugs](https://github.com/whatwg/meta/blob/main/MAINTAINERS.md#handling-pull-requests) are filed:
* Chrome: …
* Firefox: …
* Safari: …
* Deno: …
You can view, comment on, or merge this pull request online at:
https://github.com/whatwg/fetch/pull/1392
-- Commit Summary --
* Add `Response.json` static method
-- File Changes --
M fetch.bs (47)
-- Patch Links --
https://github.com/whatwg/fetch/pull/1392.patch
https://github.com/whatwg/fetch/pull/1392.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1392
You are receiving this because you are subscribed to this thread.
Message ID: <whatwg/fetch/pull/1392@github.com>
Received on Sunday, 30 January 2022 17:59:14 UTC