allow options as well

This commit is contained in:
Carl-Gerhard Lindesvärd
2023-11-04 20:26:35 +01:00
parent 853e6adbe2
commit 3431958c79
8 changed files with 44 additions and 20 deletions

View File

@@ -12,6 +12,10 @@ interface Request extends NextApiRequest {
}
export default async function handler(req: Request, res: NextApiResponse) {
if (req.method == 'OPTIONS') {
return res.status(202).json({});
}
if (req.method !== 'POST') {
return handleError(res, createError(405, 'Method not allowed'));
}