feat: add extensive test suite

This commit is contained in:
2026-08-30 11:33:53 +07:00 Unverified
parent 061cce00dc
commit 8359c7272e
131 changed files with 8717 additions and 2200 deletions
+6 -17
View File
@@ -1,23 +1,12 @@
import { getSessionCookie } from "better-auth/cookies";
import { type NextRequest, NextResponse } from "next/server";
import { createProxyHandler } from "@/lib/server-handlers";
export async function proxy(request: NextRequest) {
const sessionCookie = getSessionCookie(request);
// THIS IS NOT SECURE!
// This is the recommended approach to optimistically redirect users
// We recommend handling auth checks in each page/route
if (!sessionCookie) {
const url = new URL("/login", request.url);
url.searchParams.set(
"next",
request.nextUrl.pathname + request.nextUrl.search,
);
return NextResponse.redirect(url);
}
return NextResponse.next();
}
export const proxy = createProxyHandler<NextRequest>({
getSessionCookie,
redirect: NextResponse.redirect,
next: NextResponse.next,
});
export const config = {
matcher: [