-
Notifications
You must be signed in to change notification settings - Fork 330
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
Is a missing HeadersInit treated differently from an empty one? #479
Comments
Similar for RequestInit and Request. See https://fetch.spec.whatwg.org/#dom-request step 13, which is a pretty serious problem depending on how whatwg/webidl#76 shakes out. And step 29. For now, sorting this out blocks me implementing |
I guess here's my real concern. If the This dependency on whether arguments are passed individually or in a dictionary is deeply unfortunate from my point of view. |
So we count |
Well, that depends on what you mean by "we". If you do But at the moment per the IDL spec |
If we're just looking at Fetch, it only branches on whether the headers member is present. It leaves defining being present up to IDL. I guess you're saying it's always present since it takes a record? I'm not really sure I'm following. |
Right, and I question whether that's the right call.
I'm saying I would like IDL to say it's always present. But if I actually do that, then tons of fetch tests fail, because its "present and empty" behavior is different from its "not present" behavior. In some APIs, but not others, to add to the confusion. |
I guess I don't understand why a record would always be present. Surely you should be able to not pass a record? |
Well, it's a general API design decision. For dictionaries, IDL explicitly has identical behavior for For records, we made the behavior match dictionaries, because I guess people felt conceptually they were kind of the same (maybe because they were still thinking of the "half-open dictionary" case?). Note that this doesn't match what I had done with MozMap in Gecko, where I made it much more like a sequence than like a dictionary in terms of all this stuff (e.g. you can't pass undefined or null for a MozMap argument, and MozMap isn't forced to be an optional arg in trailing position, etc). It's possible that speccing record to be like dictionary was just a mistake. After all, |
So in the case of In the case of |
So I should note that no matter what we do for records passing It sounds like you'd like |
Yeah, I think |
The If in general we want omission and |
Having been asked to weigh in, here are my weak preferences:
I don't think we need a new extended attribute for any of this. |
OK, so that sounds like we should make I would be quite happy with that, since that's what Gecko implements for MozMap already. I just wish I hadn't wasted the time to align Gecko with the current IDL spec here. :( If we're all agreed with that, do you or @jyasskin have bandwidth to update IDL? If not, I can try to do that. |
@bzbarsky I created whatwg/webidl#304. |
This should be fixed by whatwg/webidl#305 already. |
Indeed, thanks! |
The relevant IDL is:
Is passing
{}
forResponseInit
equivalent to passing{ headers: {} }
? I can't quite tell from the steps at https://fetch.spec.whatwg.org/#dom-response. In particular, is step 6.1 needed? If it is, chances are those two forms are not identical at the moment..../cc @wanderview @annevk
The text was updated successfully, but these errors were encountered: