From 8816a7532b4d64d8479681bcb2930c24f9e1d7ea Mon Sep 17 00:00:00 2001 From: Todd Evanoff Date: Thu, 14 Dec 2023 15:14:59 -0800 Subject: [PATCH 1/2] remove asset caching --- src/resource-archive/index.ts | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/resource-archive/index.ts b/src/resource-archive/index.ts index d03ff3cd..4bb38575 100644 --- a/src/resource-archive/index.ts +++ b/src/resource-archive/index.ts @@ -202,24 +202,6 @@ class Watcher { return; } - const response = this.archive[request.url]; - if (response && 'statusCode' in response) { - logger.log(`pausing request we've seen before, sending previous response`); - logger.log({ - requestId, - responseCode: response.statusCode, - responsePhrase: response.statusText, - }); - await this.clientSend(request, 'Fetch.fulfillRequest', { - requestId, - responseCode: response.statusCode, - ...(response.statusText && { responsePhrase: response.statusText }), - // responseHeaders: response.headers, TODO - mapping - body: response.body.toString('base64'), - }); - return; - } - await this.clientSend(request, 'Fetch.continueRequest', { requestId, interceptResponse: true, From 3d53d71a966f73e046a6631771c3ed8feb627339 Mon Sep 17 00:00:00 2001 From: Todd Evanoff Date: Thu, 14 Dec 2023 20:48:39 -0800 Subject: [PATCH 2/2] bail early on 304 responses --- src/resource-archive/index.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/resource-archive/index.ts b/src/resource-archive/index.ts index 4bb38575..a7d9fb77 100644 --- a/src/resource-archive/index.ts +++ b/src/resource-archive/index.ts @@ -136,6 +136,12 @@ class Watcher { return; } + // There's no reponse body for us to archive on 304s + if (responseStatusCode === 304) { + await this.clientSend(request, 'Fetch.continueRequest', { requestId }); + return; + } + const requestUrl = new URL(request.url); this.firstUrl ??= requestUrl;