mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-09 23:24:07 -08:00
Merge pull request #2148 from Computroniks/bug/octopush-notifications-#2144
Fixed octopush legacy doesn't return error code
This commit is contained in:
commit
62ad2f9bb4
|
@ -49,7 +49,15 @@ class Octopush extends NotificationProvider {
|
|||
},
|
||||
params: data
|
||||
};
|
||||
await axios.post("https://www.octopush-dm.com/api/sms/json", {}, config);
|
||||
|
||||
// V1 API returns 200 even on error so we must check
|
||||
// response data
|
||||
let response = await axios.post("https://www.octopush-dm.com/api/sms/json", {}, config);
|
||||
if ("error_code" in response.data) {
|
||||
if (response.data.error_code !== "000") {
|
||||
this.throwGeneralAxiosError(`Octopush error ${JSON.stringify(response.data)}`);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new Error("Unknown Octopush version!");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue