Revert "feat: add ctx.redirect() helper (#2358)" (#2372)

Mostly so that it's easier to cut the next patch release for Fresh.

This reverts commit e3508c3054.
This commit is contained in:
Marvin Hagemeister
2024-03-21 10:27:53 +01:00
committed by GitHub
parent c797716a56
commit 240252fdb4
8 changed files with 20 additions and 82 deletions
+5 -1
View File
@@ -12,7 +12,11 @@ export async function handler(
// Redirect from old doc URLs to new ones
const redirect = REDIRECTS[ctx.url.pathname];
if (redirect) {
return ctx.redirect(redirect, 307);
const url = new URL(redirect, ctx.url.origin);
return new Response("", {
status: 307,
headers: { location: url.href },
});
}
return await ctx.next();