Merge pull request #2148 from Computroniks/bug/octopush-notifications-#2144

Fixed octopush legacy doesn't return error code
pull/2127/head^2
Louis Lam 2 years ago committed by GitHub
commit 62ad2f9bb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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…
Cancel
Save