From dc0951a6bd147467c43c3aa224d50afd2343e72a Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Tue, 9 Sep 2025 05:26:05 -0700 Subject: [PATCH] Update index.js --- index.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index 32c97fb..a682017 100644 --- a/index.js +++ b/index.js @@ -1,12 +1,11 @@ -const corsHeaders = { - 'Access-Control-Allow-Origin': '*', - 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS', - 'Access-Control-Allow-Headers': 'Authorization, Content-Type', -} - async function fetch(request) { - if (request.method === 'OPTIONS') return new Response(null, { headers: corsHeaders }) - return new Response('OK', { headers: corsHeaders }) + if (request.method === 'OPTIONS') { + const headers = new Headers() + headers.set('Access-Control-Allow-Origin', '*') + headers.set('Access-Control-Allow-Headers', 'Authorization, Content-Type') + return new Response(null, { headers }) + } + return new Response('OK') } export default { fetch }