return empty body correctly
This commit is contained in:
@@ -164,7 +164,7 @@ export const api = {
|
|||||||
fetch(url, fetchOptions)
|
fetch(url, fetchOptions)
|
||||||
.then(async (response) => {
|
.then(async (response) => {
|
||||||
let data: string | object = "";
|
let data: string | object = "";
|
||||||
if (fetchOptions.method.toLowerCase() != "delete") {
|
if (response.headers.get("content-length") !== "0") {
|
||||||
if (
|
if (
|
||||||
response &&
|
response &&
|
||||||
response.headers.get("content-type") == null
|
response.headers.get("content-type") == null
|
||||||
@@ -174,9 +174,13 @@ export const api = {
|
|||||||
? await response.json()
|
? await response.json()
|
||||||
: {};
|
: {};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
data = response.text
|
try {
|
||||||
? await response.text()
|
data = response.text
|
||||||
: "";
|
? await response.text()
|
||||||
|
: "";
|
||||||
|
} catch (error) {
|
||||||
|
data = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
data =
|
data =
|
||||||
|
|||||||
Reference in New Issue
Block a user