TypeScriptInjection & inputDifficulty 2/3
// app/api/webhooks/test/route.ts
import { getSession } from "@/lib/session";
export async function POST(req: Request) {
const session = await getSession();
if (!session) {
return Response.json({ error: "Unauthorized" }, { status: 401 });
}
const { url } = await req.json();
const res = await fetch(url, {
method: "POST",
body: JSON.stringify({ event: "ping" }),
headers: { "Content-Type": "application/json" },
});
return Response.json({ status: res.status });
}