fix(ui): revert use mode:no-cors for fetch GET requests

responses for mode:no-cors requests have no body, which we need
This commit is contained in:
Łukasz Mierzwa
2019-11-14 19:46:21 +00:00
parent fa06e42ef2
commit 94b91c3a47
3 changed files with 2 additions and 15 deletions

View File

@@ -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));

View File

@@ -18,7 +18,7 @@ describe("Fetch", () => {
};
const methodOptions = {
FetchGet: { method: "GET", mode: "no-cors" },
FetchGet: { method: "GET" },
FetchPost: { method: "POST" },
FetchDelete: { method: "DELETE" }
};

View File

@@ -89,7 +89,6 @@ describe("<SilencePreview />", () => {
"./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("<SilencePreview />", () => {
"./alerts.json?q=foo%3Dbar&q=%40alertmanager%3D~%5E%28am1%7Cam2%29%24",
{
method: "GET",
mode: "no-cors",
credentials: "include",
redirect: "follow"
}