Some checks failed
✅ Check / 🔬 ESLint (push) Failing after 21s
✅ Check / 🏷️ Typecheck (push) Failing after 11s
✅ Check / 🔎 Test (push) Failing after 11s
✅ Check / e2e-test (push) Failing after 11s
✅ Check / 🔨 Build (push) Failing after 11s
🚀 Deploy / 🚀 Deploy (doc) (push) Failing after 12s
🚀 Deploy / 🚀 Deploy (demo) (push) Failing after 12s
🚀 Deploy / 🚀 Deploy (supabase) (push) Failing after 18s
21 lines
506 B
TypeScript
21 lines
506 B
TypeScript
export const corsHeaders = {
|
|
"Access-Control-Allow-Origin": "*",
|
|
"Access-Control-Allow-Headers":
|
|
"authorization, x-client-info, apikey, content-type",
|
|
"Access-Control-Allow-Methods": "POST, PATCH, DELETE",
|
|
};
|
|
|
|
/**
|
|
* Handle OPTIONS requests for CORS preflight.
|
|
*/
|
|
export function OptionsMiddleware(
|
|
req: Request,
|
|
next: (req: Request) => Promise<Response>,
|
|
) {
|
|
if (req.method === "OPTIONS") {
|
|
return new Response(null, { status: 204, headers: corsHeaders });
|
|
}
|
|
|
|
return next(req);
|
|
}
|