@hkdigital/lib-sveltekit 0.1.100 → 0.1.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -347,6 +347,12 @@ export default class IndexedDbCache {
|
|
347
347
|
return;
|
348
348
|
}
|
349
349
|
|
350
|
+
// Clone Blob before reference becomes invalid
|
351
|
+
let clonedBody = entry.body;
|
352
|
+
if (entry.body instanceof Blob) {
|
353
|
+
clonedBody = entry.body.slice(0, entry.body.size, entry.body.type);
|
354
|
+
}
|
355
|
+
|
350
356
|
// Check if expired
|
351
357
|
if (entry.expires && Date.now() > entry.expires) {
|
352
358
|
// Delete expired entry (but don't block)
|
@@ -387,17 +393,10 @@ export default class IndexedDbCache {
|
|
387
393
|
try {
|
388
394
|
let responseHeaders = new Headers(entry.headers);
|
389
395
|
|
390
|
-
let responseBody = entry.body;
|
391
|
-
|
392
|
-
// if (responseBody instanceof Blob) {
|
393
|
-
// // Clone the blob to ensure it's not consumed
|
394
|
-
// responseBody = entry.body.slice(0, entry.body.size, entry.body.type);
|
395
|
-
// }
|
396
|
-
|
397
396
|
// Create Response safely
|
398
397
|
let response;
|
399
398
|
try {
|
400
|
-
response = new Response(
|
399
|
+
response = new Response(clonedBody, {
|
401
400
|
status: entry.status,
|
402
401
|
statusText: entry.statusText,
|
403
402
|
headers: responseHeaders
|