From 94b91c3a47034afe514d08d0d5203e0a9e2b044e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Thu, 14 Nov 2019 19:46:21 +0000 Subject: [PATCH] fix(ui): revert use mode:no-cors for fetch GET requests responses for mode:no-cors requests have no body, which we need --- ui/src/Common/Fetch.js | 13 +------------ ui/src/Common/Fetch.test.js | 2 +- .../SilenceModal/SilencePreview/index.test.js | 2 -- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/ui/src/Common/Fetch.js b/ui/src/Common/Fetch.js index a62de42a0..9f4349ff6 100644 --- a/ui/src/Common/Fetch.js +++ b/ui/src/Common/Fetch.js @@ -6,18 +6,7 @@ const CommonOptions = { }; const FetchGet = async (uri, options) => - await fetch( - uri, - merge( - {}, - { - method: "GET", - mode: "no-cors" - }, - CommonOptions, - options - ) - ); + await fetch(uri, merge({}, { method: "GET" }, CommonOptions, options)); const FetchPost = async (uri, options) => await fetch(uri, merge({}, { method: "POST" }, CommonOptions, options)); diff --git a/ui/src/Common/Fetch.test.js b/ui/src/Common/Fetch.test.js index 7218c76c9..c5257dfc6 100644 --- a/ui/src/Common/Fetch.test.js +++ b/ui/src/Common/Fetch.test.js @@ -18,7 +18,7 @@ describe("Fetch", () => { }; const methodOptions = { - FetchGet: { method: "GET", mode: "no-cors" }, + FetchGet: { method: "GET" }, FetchPost: { method: "POST" }, FetchDelete: { method: "DELETE" } }; diff --git a/ui/src/Components/SilenceModal/SilencePreview/index.test.js b/ui/src/Components/SilenceModal/SilencePreview/index.test.js index 66935abc6..f6d794530 100644 --- a/ui/src/Components/SilenceModal/SilencePreview/index.test.js +++ b/ui/src/Components/SilenceModal/SilencePreview/index.test.js @@ -89,7 +89,6 @@ describe("", () => { "./alerts.json?q=foo%3Dbar&q=%40alertmanager%3D~%5E%28amValue%29%24", { method: "GET", - mode: "no-cors", credentials: "include", redirect: "follow" } @@ -108,7 +107,6 @@ describe("", () => { "./alerts.json?q=foo%3Dbar&q=%40alertmanager%3D~%5E%28am1%7Cam2%29%24", { method: "GET", - mode: "no-cors", credentials: "include", redirect: "follow" }