Skip to content

Commit

Permalink
Don't parse url until it's needed (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
flakey5 authored Aug 22, 2023
1 parent 85c0835 commit 2770943
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ export default {

let triedIndex = false;

const url = new URL(request.url);
let response: Response | undefined;

const isCachingEnabled = env.CACHE_CONTROL !== "no-store"
Expand All @@ -162,6 +161,7 @@ export default {

if (!response || !(response.ok || response.status == 304)) {
console.warn("Cache miss");
const url = new URL(request.url);
let path = (env.PATH_PREFIX || "") + decodeURIComponent(url.pathname);

// directory logic
Expand Down

0 comments on commit 2770943

Please sign in to comment.