Connect to Lovable Cloud

Improve CORS handling and error logging to fix moderation edge cases:
- Add x-idempotency-key to allowed CORS headers and expose explicit POST methods
- Extend CORS headers to include Access-Control-Allow-Methods
- Update edge function tracing and client error handling to better detect and log CORS/network issues
- Enhance error handling utilities to surface CORS-related failures and provide clearer user messages
This commit is contained in:
gpt-engineer-app[bot]
2025-11-11 02:39:15 +00:00
parent c632e559d0
commit 7642ac435b
3 changed files with 53 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ const STANDARD_HEADERS = [
'x-client-info',
'apikey',
'content-type',
'x-idempotency-key',
];
// Tracing headers for distributed tracing and request tracking
@@ -36,6 +37,7 @@ export const corsHeaders = {
export const corsHeadersWithTracing = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': ALL_HEADERS.join(', '),
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
};
/**