diff options
| author | Shulhan <ms@kilabit.info> | 2024-01-25 20:57:34 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2024-01-25 20:57:34 +0700 |
| commit | fba06786185ee70bf6e3b558b930d1f4e3b97545 (patch) | |
| tree | 8afb23be52752f514d423945c98075c036a38d6c /_www | |
| parent | 099ccef4614d8b3ba19f44c50ef984631d161240 (diff) | |
| download | gorankusu-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')
| -rw-r--r-- | _www/trunks.js | 12 | ||||
| -rw-r--r-- | _www/trunks.ts | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/_www/trunks.js b/_www/trunks.js index bae22fe..8866a31 100644 --- a/_www/trunks.js +++ b/_www/trunks.js @@ -247,7 +247,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; } @@ -265,7 +265,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; } @@ -275,7 +275,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; @@ -318,12 +318,12 @@ export class Trunks { body: JSON.stringify(req), }); const jsonRes = await httpRes.json(); - if (jsonRes.code != 200) { + if (jsonRes.code >= 400) { wuiNotif.error(jsonRes.message); return null; } const res = jsonRes.data; - if (res.ResponseStatusCode != 200) { + if (res.ResponseStatusCode >= 400) { wuiNotif.error(`${httpTarget.Name}: ${res.ResponseStatus}`); } else { @@ -354,7 +354,7 @@ export class Trunks { body: JSON.stringify(req), }); const jsonRes = await fres.json(); - if (jsonRes.code != 200) { + if (jsonRes.code >= 400) { wuiNotif.error(jsonRes.message); return null; } 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; } |
