From f12b693e0fffd1ee089cd907aa7893e22f4593fd Mon Sep 17 00:00:00 2001 From: Eduard Kuzmenko Date: Sun, 16 May 2021 05:21:41 +0400 Subject: [PATCH] Add 'Content-Length' for cacheStorage --- src/lib/cacheStorage.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/cacheStorage.ts b/src/lib/cacheStorage.ts index 19f56738..c6b66da2 100644 --- a/src/lib/cacheStorage.ts +++ b/src/lib/cacheStorage.ts @@ -62,7 +62,13 @@ export default class CacheStorageController { blob = blobConstruct(blob) as Blob; } - return this.save(fileName, new Response(blob)).then(() => { + const response = new Response(blob, { + headers: { + 'Content-Length': '' + blob.size + } + }); + + return this.save(fileName, response).then(() => { return blob as Blob; }); }