Update request_manager.ts

This commit is contained in:
ITOH
2021-02-25 18:37:23 +01:00
parent 2fcdbe5822
commit 5756e137a5

View File

@@ -222,16 +222,17 @@ function runMethod(
!url.startsWith(IMAGE_BASE_URL)
) {
return fetch(url, {
body: JSON.stringify({
url,
method,
body: body || {},
}),
body: JSON.stringify(body || {}),
headers: {
authorization: restAuthorization,
},
method: method.toUpperCase(),
})
.then((res) => res.json())
.then((res) => {
if (res.status === 204) return undefined;
return res.json();
})
.catch((error) => {
console.error(error);
throw errorStack;