headers endpoint

This commit is contained in:
Max Peintner
2025-01-31 21:07:05 +01:00
parent fe256f49ef
commit cc724889f0

View File

@@ -0,0 +1,17 @@
import { NextRequest, NextResponse } from "next/server";
export const dynamic = "force-dynamic";
export const revalidate = false;
export const fetchCache = "default-no-store";
export async function GET(request: NextRequest) {
const headers = request.headers;
// Convert headers to a plain object
const headersObject: Record<string, string> = {};
headers.forEach((value, key) => {
headersObject[key] = value;
});
return NextResponse.json(headersObject);
}