-
Notifications
You must be signed in to change notification settings - Fork 0
Standardize supported subset of fetch
#2
Comments
With regards to CORS, I can imagine a case where a runtime does implement the notion of an origin (e.g. imagine some future where we allow specifying an origin at Node.js startup or when creating a worker thread). For this, I think we craft this bit to say that if the runtime implements origins then it should fully implement the CORS portion of the fetch specification, otherwise those pieces should be omitted / stubbed out when necessary. Note that this also raises the question about whether runtimes that choose not to implement any given API should just simply omit those APIs vs. implementing non-functional stubs... Whatever we decide on that should be a rule we apply consistently across everything. This is relevant, for instance in regards to Request object, per the comment:
I think that even if the fields are not supported, the fields should be at least present on the |
I don't think that's work for Deno @jasnell since they implement the location API and have a globalThis.location which they use to make relative requests in |
That bit makes sense to me |
Then let's explicitly make this piece fully optional as opposed to saying that server's don't implement it. It's entirely possible that some non-browser runtime could support this and we don't want to rule it out. What we can say instead is that given that the need to support origins is not absolute across runtimes, it is perfectly fine for implementations of this profile of fetch to not implement any of the origin/CORS-related mechanisms. |
One thing we've desired to do in our projects (such as Apollo Server) is allow users who care about precisely how our software makes HTTP requests to pass in their own implementation of the (The solution we came up with is to refuse to ever pass (Apologies if this should have been a separate issue; not clear what the scope of this one is.) |
In my opinion (based on working on For example, in Node.js, since we currently do not have the concept of an The WinterCG Fetch spec could explicitly define these warnings/error paths based on relative aspects of Fetch such as |
We should discuss things like cors behavior - there are questions/suggestions about this in nodejs/undici#1315 (comment)
I think https://deno.land/manual/runtime/web_platform_apis#spec-deviations is a good baseline but I would request the following deviations for what we standardize:
Of course, this would need to be bike-shedded and written more formally. Please suggest any more deviations we'd want here.
Note this list omits the handling of
file:
urls. Node.js does not wish to implement file url support at the moment because of security concerns. People (@mcollina for example) have raised good concerns it would be too easy to get afile
url from a user and pass that tofetch
. I think it's probably fine for servers/edge to deviate on this?cc @lucacasonato
The text was updated successfully, but these errors were encountered: