aboutsummaryrefslogtreecommitdiff
path: root/_www/trunks.ts
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2024-01-25 20:57:34 +0700
committerShulhan <ms@kilabit.info>2024-01-25 20:57:34 +0700
commitfba06786185ee70bf6e3b558b930d1f4e3b97545 (patch)
tree8afb23be52752f514d423945c98075c036a38d6c /_www/trunks.ts
parent099ccef4614d8b3ba19f44c50ef984631d161240 (diff)
downloadgorankusu-fba06786185ee70bf6e3b558b930d1f4e3b97545.tar.xz
_www: check HTTP response status greater or equal 400
Any HTTP status code below 400 are still processable and not an error.
Diffstat (limited to '_www/trunks.ts')
-rw-r--r--_www/trunks.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/_www/trunks.ts b/_www/trunks.ts
index c35977c..9f470f0 100644
--- a/_www/trunks.ts
+++ b/_www/trunks.ts
@@ -324,7 +324,7 @@ export class Trunks {
body: JSON.stringify(attackReq),
});
const jsonRes = await httpRes.json();
- if (jsonRes.code != 200) {
+ if (jsonRes.code >= 400) {
wuiNotif.error(jsonRes.message);
return null;
}
@@ -346,7 +346,7 @@ export class Trunks {
method: "DELETE",
});
const jsonRes = await fres.json();
- if (jsonRes.code != 200) {
+ if (jsonRes.code >= 400) {
wuiNotif.error(jsonRes.message);
return null;
}
@@ -357,7 +357,7 @@ export class Trunks {
const url = API_ATTACK_RESULT + "?name=" + name;
const fres = await fetch(url);
const res = await fres.json();
- if (res.code != 200) {
+ if (res.code >= 400) {
wuiNotif.error(res.message);
}
return res;
@@ -413,14 +413,14 @@ export class Trunks {
});
const jsonRes = await httpRes.json();
- if (jsonRes.code != 200) {
+ if (jsonRes.code >= 400) {
wuiNotif.error(jsonRes.message);
return null;
}
const res = jsonRes.data as RunResponseInterface;
- if (res.ResponseStatusCode != 200) {
+ if (res.ResponseStatusCode >= 400) {
wuiNotif.error(`${httpTarget.Name}: ${res.ResponseStatus}`);
} else {
wuiNotif.info(`${httpTarget.Name}: ${res.ResponseStatus}`);
@@ -458,7 +458,7 @@ export class Trunks {
});
const jsonRes = await fres.json();
- if (jsonRes.code != 200) {
+ if (jsonRes.code >= 400) {
wuiNotif.error(jsonRes.message);
return null;
}