You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The above lets me respond from the network but update the cache at the same time. Pretty confident this will be a common pattern. It works, assuming "addResponse" doesn't throw if the url already exists.
Allowing add to take requests feels right, since it's current argument, a url, is going to be turned into a request anyway, you just don't get control over the methods, headers etc.
(yeah, I think response is supposed to be url or requestUrl in the spec. You can feed responses directly into caches, but urls and requests should work too)
Usecase:
The above lets me respond from the network but update the cache at the same time. Pretty confident this will be a common pattern. It works, assuming "addResponse" doesn't throw if the url already exists.
This wouldn't work as well:
Neater, but the two requests could differ in headers so the browser may make two requests.
Ideally:
This depends on
cache.add
taking requests & being smart enough to make a single request.The text was updated successfully, but these errors were encountered: