From 2a445cfdc20f8cacc678c5e81df916d83a26459b Mon Sep 17 00:00:00 2001 From: Siklos Date: Sun, 31 Jul 2022 23:21:00 +0200 Subject: [PATCH] App.tsx: Remove headers in request --- src/App.tsx | 12 +++--------- test-server/http.js | 6 ++---- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 7f9a129..eaebbb1 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -121,16 +121,10 @@ class App extends React.Component { async function fetchConfiguration(): Promise { const url = `${import.meta.env.VITE_API_URL}`; - const myHeaders = new Headers({ - 'Content-Type': 'application/json' - }); - const myInit = { - method: 'POST', - headers: myHeaders - }; - - return await fetch(url, myInit) + return await fetch(url, { + method: 'POST' + }) .then((response) => response.json() ) as Configuration; diff --git a/test-server/http.js b/test-server/http.js index b30acac..a37e9b2 100644 --- a/test-server/http.js +++ b/test-server/http.js @@ -37,8 +37,7 @@ serve({ status: 200, headers: { 'Content-Type': 'application/json', - 'Access-Control-Allow-Origin': '*', - 'Access-Control-Allow-Headers': '*' + 'Access-Control-Allow-Origin': '*' } }); } @@ -47,8 +46,7 @@ serve({ status: 200, headers: { 'Content-Type': 'text/plain', - 'Access-Control-Allow-Origin': '*', - 'Access-Control-Allow-Headers': '*' + 'Access-Control-Allow-Origin': '*' } }); }