From 8d5d20b70354c3a3ae8cddfab6b6ba44bc94ecfc Mon Sep 17 00:00:00 2001 From: Michael Mainguy Date: Tue, 7 Nov 2023 13:32:47 -0600 Subject: [PATCH] Updated config and OPTIONS method for function. --- netlify/functions/users/users.mts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/netlify/functions/users/users.mts b/netlify/functions/users/users.mts index ae0df6a..8403225 100644 --- a/netlify/functions/users/users.mts +++ b/netlify/functions/users/users.mts @@ -7,9 +7,9 @@ const authToken = Buffer.from(auth).toString('base64'); function buildOptions(req: Request) { if (req.method == 'OPTIONS') { - const origin = req.headers['origin']; + const origin = req.headers.get('Origin'); console.log(origin); - return new Response( + const res = new Response( "", { headers: { @@ -20,7 +20,9 @@ function buildOptions(req: Request) { 'Access-Control-Allow-Credentials': 'true' }, status: 200 - }) + }); + console.log(res); + return res; } else { return null; }