-
Notifications
You must be signed in to change notification settings - Fork 0
Request/Response browser differences #6
Comments
Additional behaviour to align is whether to ignore or throw on unsupported options. |
My preference is to not implement any of these fields, not have the getters for them present on the prototype, and as such not explicitly raise any errors about these fields. We briefly had previous behaviour in the past, but usage showed that users prefer the fields to not be present at all. Please take a look at denoland/deno#10286 |
pinging @ronag and @jimmywarting |
I have wonder what i would maybe try to build next now that fetch is built right in to NodeJS and i have had my ideas on a some CacheStorage but for the server side. |
undici supports |
Currently, both the
Request
andResponse
classes contain a bunch of properties that likely have no effect server-side.Request:
request.destination
request.referrer
request.referrerPolicy
request.mode
*request.cache
"...indicating how the request will interact with the browser’s cache when fetching"request.integrity
"A cryptographic hash of the resource to be fetched by request."request.isReloadNavigation
request.isHistoryNavigation
RequestInit
(options that are passed to the
Request
constructor)RequestInit.referrer
: "A string whose value is a same-origin URL"RequestInit.referrerPolicy
: "A referrer policy to set request’s referrerPolicy."RequestInit.mode
: "A string to indicate whether the request will use CORS, or will be restricted to same-origin URLs. Sets request’s mode. If input is a string, it defaults to "cors"."RequestInit.credentials
: seerequest.credentials
*RequestInit.cache
: seerequest.cache
RequestInit.integrity
: seerequest.integrity
RequestInit.window
: "Can only be null. Used to disassociate request from any Window."Response
response.type
***
omit
andinclude
may be useful for developers, howeversame-origin
is not.**
cors
should be omitted from this type.Implementations:
Aligning Behavior
As you can see, each environment is different in supported properties which can cause cross-platform confusion. It also makes everything more confusing considering that these platforms typically leave in unsupported properties in their typings, but do not document which types are ignored (unless you look for it on google).
Potential Solutions:
false
forrequest.isHistoryNavigation
). Default flags would also be needed forRequestInit
as the spec heavily defines fetch's behavior from certain flags being set.The text was updated successfully, but these errors were encountered: