Skip to content

Commit

Permalink
Merge pull request #43 from chromaui/todd/remove-asset-caching
Browse files Browse the repository at this point in the history
Remove asset caching
  • Loading branch information
tevanoff authored Dec 15, 2023
2 parents 946ffbf + 3d53d71 commit feab910
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions src/resource-archive/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -202,24 +208,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,
Expand Down

0 comments on commit feab910

Please sign in to comment.