Skip to content

Commit

Permalink
fix: workaround itty-router issue with cached responses
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelgerber committed Dec 19, 2024
1 parent db220f1 commit a985301
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion functions/grapher/[slug].ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ const router = Router<
[URL, Env, Etag, EventContext<unknown, any, Record<string, unknown>>]
>({
before: [preflight],
finally: [corsify],
finally: [
// This is a workaround for a bug in itty-router; without this, we would get 500 errors with
// "Can't modify immutable headers." for requests served from cache.
// see https://github.com/kwhitley/itty-router/issues/242#issuecomment-2194227007
(resp: Response) => corsify(new Response(resp.body, resp)),
],
})
router
.get(
Expand Down

0 comments on commit a985301

Please sign in to comment.