-
Notifications
You must be signed in to change notification settings - Fork 201
Add Response.json() static method to Fetch
#1091
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This is a Baseline 2023 feature, albeit a minor one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am really on the fence about this addition. I think we'll have a hard time coming up with guidelines for notability that explains why this is a feature but for example MIDIOutput's clear() isn't.
@ddbeck if we had all of the tools to express composite features, subfeatures, feature evolution, etc., that we've been discussing, do you think this would still have its own identifier?
features/response-json.yml
Outdated
| name: Response.JSON() | ||
| description: The `Response.JSON()` static method creates a `Response` object from a JSON body. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| name: Response.JSON() | |
| description: The `Response.JSON()` static method creates a `Response` object from a JSON body. | |
| name: Response.json() | |
| description: The `Response.json()` static method creates a `Response` object from a JSON body. |
I was also on the fence about this one, but we have several other static method features. I think it's only been implied so far, but static methods seem somewhat special. If a static method was a new global method, it'd definitely become a new feature, right?
If we had all of them? No, probably not. I'd probably be OK with this being a later addition on the main If you like, I can recast this as a later addition comment on fetch and maybe we could spend some time in the first or second week of June to put together a concrete "later additions" proposal (ideally, a PR). |
A lot of global methods stand on their own, but some like Static methods more generally I think we can handle like any other API surface, be it constructors, instance methods, properties, or whatnot.
I think adding this now won't have any long term ill effects, so I'm OK with adding it. But yes, I think it's a good case to figure out as part of a "later additions" model. |
foolip
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving to leave the door open to landing this now, or waiting to figure out "later additions". I don't feel strongly enough to make a decision.
|
I'm sitting on this until we get later additions. Switching to draft. |
Response.JSON() static method featureResponse.json() static method feature
|
@foolip I've redone this as a later addition to |
features/fetch.yml
Outdated
| caniuse: fetch | ||
| status: | ||
| compute_from: | ||
| - api.fetch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This single entry would be enough I think, but listing a few more doesn't change anything. We'll need some kind of guidance for what people should prefer, however.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was on the fence about this myself, but here's a possible heuristic:
I looked at the first few code samples on the MDN overview page for the feature. On some of the samples, Headers preceded fetch(), so I figured: where's the first place you're likely to hit a non-available feature? That should go in compute_from.
Though I guess now that I've said this, Response could probably be dropped. Feels… impure to leave just one interface out though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's wrong with just compute_from: api.fetch?
| - api.Response.url | ||
| - api.fetch | ||
|
|
||
| # baseline: low |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay, dist grouping works!
Response.json() static method featureResponse.json() static method to Fetch
| @@ -1,7 +1,13 @@ | |||
| name: Fetch (initial support) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ddbeck I changed the name here. I feel like we'll have very few "initial support" features left in the long term, but am not sure what the name guideline should be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call on renaming this. Thank you!
This is a Baseline 2023 feature, albeit a minor one.
A question here: should we have a
fetchgroup? Or just let this be swept up by fetch snapshots?