Skip to content

Commit

Permalink
Short cicuiting OPTIONS call with empty response.
Browse files Browse the repository at this point in the history
  • Loading branch information
rupamkairi committed Jan 22, 2025
1 parent f1f3de6 commit cc0ee2e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/server/src/pages/api/v1/fires/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export default async function firesBySiteHandler(

// checkMethods(req, res, ["GET"]);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
if (!["OPTIONS", "GET"].includes(req.method!)) {
if (req.method === 'OPTIONS') { return res.status(200).send("Ok") }
if (req.method === 'OPTIONS') { return res.status(200).end() }
if (!["GET"].includes(req.method!)) {
return res.status(405).json({ message: "Method Not Allowed" });
}

Expand Down

0 comments on commit cc0ee2e

Please sign in to comment.