I want to be able to use fetch
without using the cache and was surprised to see this isn’t readily possible.
The problem is that if I use fetch
then it just takes from the cache so I can’t easily make a ‘clean fetch’.
await fetch(new Request('https://example.com/cats.html'))
Why is there no option something like: cf: { bypassCache: true }
?
The only way I can see to achieve this is:
var response = await fetch(new Request('https://example.com/cats.html?cacheBuster=' + Number(new Date())));
caches.default.put(new Request('https://example.com/cats.html'), response)
Is there really no way to force a clean fetch?