From 9212f499c93516c3257c3728aef1951405a9cf1b Mon Sep 17 00:00:00 2001 From: Urko Tamayo Date: Tue, 21 Mar 2023 11:14:22 +0100 Subject: [PATCH 1/3] Cors added to constants.js and index.js --- src/constants.js | 2 +- src/handlers/index.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/constants.js b/src/constants.js index a46fb3a..f0e6d6a 100644 --- a/src/constants.js +++ b/src/constants.js @@ -1,5 +1,5 @@ export const HEADERS = { - headers: { 'content-type': 'application/json;charset=UTF-8' }, + headers: { 'content-type': 'application/json;charset=UTF-8', 'Access-Control-Allow-Origin': '*','Access-Control-Allow-Methods': 'GET,HEAD,POST,OPTIONS' }, }; export const RADIO = 'radios'; diff --git a/src/handlers/index.js b/src/handlers/index.js index 10818d9..83c2c23 100644 --- a/src/handlers/index.js +++ b/src/handlers/index.js @@ -90,6 +90,8 @@ export const index = async (request) => { return new Response(html, { headers: { 'content-type': 'text/html;charset=UTF-8', + 'Access-Control-Allow-Origin': '*', + 'Access-Control-Allow-Methods': 'GET,HEAD,POST,OPTIONS', }, }); }; From 555e08199c65fb4e7cd9fd6e2a3ea32964a07d0a Mon Sep 17 00:00:00 2001 From: Urko Tamayo Date: Tue, 21 Mar 2023 11:14:22 +0100 Subject: [PATCH 2/3] Cors added to constants.js and index.js --- src/constants.js | 2 +- src/handlers/index.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/constants.js b/src/constants.js index a46fb3a..f68188e 100644 --- a/src/constants.js +++ b/src/constants.js @@ -1,5 +1,5 @@ export const HEADERS = { - headers: { 'content-type': 'application/json;charset=UTF-8' }, + headers: { 'content-type': 'application/json;charset=UTF-8', 'Access-Control-Allow-Origin': '*' }, }; export const RADIO = 'radios'; diff --git a/src/handlers/index.js b/src/handlers/index.js index 10818d9..755a79b 100644 --- a/src/handlers/index.js +++ b/src/handlers/index.js @@ -90,6 +90,7 @@ export const index = async (request) => { return new Response(html, { headers: { 'content-type': 'text/html;charset=UTF-8', + 'Access-Control-Allow-Origin': '*', }, }); }; From bedfd4dc82f31c3d69102440aa84cc079427ba4d Mon Sep 17 00:00:00 2001 From: Urko <43012012+utamayo@users.noreply.github.com> Date: Tue, 21 Mar 2023 13:27:40 +0100 Subject: [PATCH 3/3] Update constants.js --- src/constants.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/constants.js b/src/constants.js index 8b32d8f..e323976 100644 --- a/src/constants.js +++ b/src/constants.js @@ -1,10 +1,5 @@ export const HEADERS = { -<<<<<<< HEAD headers: { 'content-type': 'application/json;charset=UTF-8', 'Access-Control-Allow-Origin': '*' }, -======= - headers: { 'content-type': 'application/json;charset=UTF-8', 'Access-Control-Allow-Origin': '*','Access-Control-Allow-Methods': 'GET,HEAD,POST,OPTIONS' }, ->>>>>>> 9212f499c93516c3257c3728aef1951405a9cf1b -}; export const RADIO = 'radios'; export const PROGRAM = 'program';