Currently, both the Request and Response 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: see request.credentials *
RequestInit.cache: see request.cache
RequestInit.integrity: see request.integrity
RequestInit.window: "Can only be null. Used to disassociate request from any Window."
Response
response.type **
* omit and include may be useful for developers, however same-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:
- Choose default values to return for useless flags (for example, node.js' Request class will always return
false for request.isHistoryNavigation). Default flags would also be needed for RequestInit as the spec heavily defines fetch's behavior from certain flags being set.
- Fork the fetch spec and remove mentions of these flags, along with conditions that would no longer be possible with said flags being removed. This would be a lot of work.
- Create a new document that would supersede certain steps/behaviors in the fetch spec. For example:
<-- Original fetch spec -->
# some title
1. If request's mode is "cors" then:
...
2. Perform scheme fetch.
3. If request's `referrer` is not this's current settings origin url then:
1. Abort this request.
2. Return a network error.
// and so on
<-- Server environment spec -->
# some title
1. Ignore step 1
3. Ignore step 3
// and so on
Currently, both the
RequestandResponseclasses contain a bunch of properties that likely have no effect server-side.Request:
request.destinationrequest.referrerrequest.referrerPolicyrequest.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.isReloadNavigationrequest.isHistoryNavigationRequestInit
(options that are passed to the
Requestconstructor)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.cacheRequestInit.integrity: seerequest.integrityRequestInit.window: "Can only be null. Used to disassociate request from any Window."Response
response.type***
omitandincludemay be useful for developers, howeversame-originis not.**
corsshould 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:
falseforrequest.isHistoryNavigation). Default flags would also be needed forRequestInitas the spec heavily defines fetch's behavior from certain flags being set.