d3ro-voice/server/supabase/functions/_shared/cors.ts
2026-08-29 18:33:45 +09:00

17 lines
628 B
TypeScript

// server/supabase/functions/_shared/cors.ts
// Edge Function 공통 CORS 헤더
export const corsHeaders: Record<string, string> = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers':
'authorization, x-client-info, apikey, content-type, idempotency-key, x-d3ro-generation-purpose',
'Access-Control-Allow-Methods': 'GET, POST, PATCH, DELETE, OPTIONS',
'Access-Control-Expose-Headers': 'x-d3ro-generation-id',
}
export function handleCorsPreflightRequest(req: Request): Response | null {
if (req.method === 'OPTIONS') {
return new Response('ok', { headers: corsHeaders })
}
return null
}