Something went wrong. Try again.
My website. cameron.stream
Something went wrong. Try again.
1234567891011121314import type { MiddlewareHandler } from "hono";
export const canonicalizeTrailingSlash: MiddlewareHandler = async (context, next) => { const path = context.req.path; const method = context.req.method;
if ((method === "GET" || method === "HEAD") && path !== "/" && path.endsWith("/")) { const { search } = new URL(context.req.url); return context.redirect(`${path.slice(0, -1)}${search}`, 301); }
await next();};