redirect.ts
Raw
1export function redirect(location: string, setCookie?: string): Response {
2 const headers: Record<string, string> = { Location: location };
3 if (setCookie) headers["Set-Cookie"] = setCookie;
4 return new Response(null, { status: 302, headers });
5}
6