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
@@ -1,7 +1,13 @@
import { Handlers } from "$fresh/server.ts";
export const handler: Handlers<unknown, { data: string }> = {
GET(_req, ctx) {
return ctx.redirect(ctx.url.origin, 302);
GET(req) {
const url = new URL(req.url);
return new Response(null, {
status: 302,
headers: {
"Location": url.origin,
},
});
},
};