Skip to content

Commit

Permalink
fix: clone req when putting it into the cache (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacasonato authored Mar 10, 2021
1 parent 22b4834 commit 9e6c337
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export class Cache {
}

async put(request: RequestInfo, response: Response): Promise<void> {
const req = request instanceof Request ? request : new Request(request);
const req = request instanceof Request
? request.clone()
: new Request(request);

const status = response.status;
const headers = Object.fromEntries(response.headers.entries());
Expand Down

0 comments on commit 9e6c337

Please sign in to comment.