[whatwg/fetch] fetch does not allow caching requests with a null client (Issue #1749)

### What problem are you trying to solve?

The FedCM spec (https://fedidcg.github.io/FedCM/) makes a number of fetch requests with a null client, such as https://fedidcg.github.io/FedCM/#fetch-config-file. But fetch does not support caching requests with a null client because the cache partition is null (https://fetch.spec.whatwg.org/#network-partition-keys via https://fetch.spec.whatwg.org/#http-cache-partitions). Because these files change rarely, it is desirable to be able to cache them if requested by the server using standard HTTP headers

### What solutions exist today?

Only solution today is to cache them in the caller of fetch, which is a lot of complexity to duplicate what the HTTP cache does today

### How would you solve it?

Probably one of:

- add a property to fetch requests named something like "cache fallback environment" that would be used by the cache partition key algorithm
- allow the fetch caller to specify a network partition key directly (not exposed to JS, of course)

### Anything else?

@domfarolino suggested not using the "reserved client" for this purpose because it's meant to be used for navigation requests

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/1749
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/issues/1749@github.com>

Received on Wednesday, 1 May 2024 19:05:58 UTC