fix: open-api doc generation failing, post patch and delete not exported (#1565)

This commit is contained in:
Meier Lukas
2024-11-28 20:21:29 +01:00
committed by GitHub
parent 44e2105a8c
commit 2d7efc3ffa
4 changed files with 58 additions and 30 deletions

View File

@@ -17,6 +17,11 @@ const handlerAsync = async (req: NextRequest) => {
const { ua } = userAgent(req);
const session: Session | null = await getSessionOrDefaultFromHeadersAsync(apiKeyHeaderValue, ipAddress, ua);
// Fallback to JSON if no content type is set
if (!req.headers.has("Content-Type")) {
req.headers.set("Content-Type", "application/json");
}
return createOpenApiFetchHandler({
req,
endpoint: "/",
@@ -82,4 +87,10 @@ const getSessionOrDefaultFromHeadersAsync = async (
return await createSessionAsync(db, apiKeyFromDb.user);
};
export { handlerAsync as GET, handlerAsync as POST };
export {
handlerAsync as GET,
handlerAsync as POST,
handlerAsync as PUT,
handlerAsync as DELETE,
handlerAsync as PATCH,
};