Skip to content
Snippets Groups Projects
Commit f5ed5f38 authored by unarist's avatar unarist Committed by Eugen Rochko
Browse files

Clone response before put it to the cache (#6932)

`Response.prototype.clone()` must be called before the response used.

This fixes an error from ServiceWorker and failing to load image when the
image is not cached.
parent 2f3ac14a
No related branches found
No related tags found
No related merge requests found
......@@ -56,10 +56,10 @@ self.addEventListener('fetch', function(event) {
const fetched = await fetch(event.request);
if (fetched.ok) {
await cache.put(event.request.url, fetched);
await cache.put(event.request.url, fetched.clone());
}
return fetched.clone();
return fetched;
}
return cached;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment