[whatwg/fetch] `only-if-cached` divergence from HTTP (#1001)

Browsing through [this](https://fetch.spec.whatwg.org/#concept-request-cache-mode):

> "only-if-cached"
> Fetch uses any response in the HTTP cache matching the request, not paying attention to staleness. If there was no response, it returns a network error.

This is different than [HTTP's semantics](https://httpwg.org/specs/rfc7234.html#cache-request-directive.only-if-cached):

> The "only-if-cached" request directive indicates that the client only wishes to obtain a stored response. If it receives this directive, a cache SHOULD either respond using a stored response that is consistent with the other constraints of the request, or respond with a 504 (Gateway Timeout) status code. 

Since it's probably too late to change this (?), it might be worth adding a note, e.g.,

> Note that "only-if-cached" works differently in Fetch than in HTTP requests [ref]; in Fetch, the response is returned regardless of staleness, whereas HTTP uses separate directives (e.g., `max-stale`).

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

Received on Tuesday, 18 February 2020 04:07:01 UTC