Skip to content

Commit

Permalink
🔨 tweak route handling
Browse files Browse the repository at this point in the history
  • Loading branch information
danyx23 committed Sep 5, 2024
1 parent f356ee0 commit 1fb06dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions functions/grapher/[slug].ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import { IRequestStrict, Router, error, cors } from "itty-router"

const { preflight, corsify } = cors({
allowMethods: "GET",
allowMethods: ["GET", "OPTIONS", "HEAD"],
})

const router = Router<IRequestStrict, [URL, Env, string]>({
Expand All @@ -27,7 +27,7 @@ router
)
.all("*", () => error(404, "Route not defined"))

export const onRequestGet: PagesFunction = async (context) => {
export const onRequest: PagesFunction = async (context) => {
// Makes it so that if there's an error, we will just deliver the original page before the HTML rewrite.
// Only caveat is that redirects will not be taken into account for some reason; but on the other hand the worker is so simple that it's unlikely to fail.
context.passThroughOnException()
Expand Down

0 comments on commit 1fb06dc

Please sign in to comment.