Repository: louislam/uptime-kuma
File: server/notification-providers/smsc.js (JavaScript)

Code before:
const NotificationProvider = require("./notification-provider");
const axios = require("axios");

class SMSC extends NotificationProvider {

    name = "smsc";

    async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
        let okMsg = "Sent Successfully.";
        try {
            let config = {
                headers: {
                    "Content-Type": "application/json",
                    // "Authorization": "Basic " + Buffer.from(notification.smscLogin + ":" + notification.smscPassword).toString("base64"),
                    "Accept": "text/json",
                }
            };

            let getArray = [
                "fmt=3",
                "translit=" + notification.smscTranslit,
                "login=" + notification.smscLogin,
                "psw=" + notification.smscPassword,
                "phones=" + notification.smscToNumber,
                "mes=" + encodeURIComponent(msg.replace(/[^\x00-\x7F]/g, "")),
            ];
            if (notification.smscSenderName !== "") {
                getArray.push("sender=" + notification.smscSenderName);
            }

            let resp = await axios.get("https://smsc.kz/sys/send.php?" + getArray.join("&"), config);
            if (resp.data.id === undefined) {
                let error = "Something gone wrong. Api returned " + resp.data.error + ". Code " + resp.data.error_code;
                this.throwGeneralAxiosError(error);
            }

            return okMsg;
        } catch (error) {
            this.throwGeneralAxiosError(error);

Review comment (suggestion):
I don't see the additional value of this line
```suggestion
```

Code after:
const NotificationProvider = require("./notification-provider");
const axios = require("axios");

class SMSC extends NotificationProvider {
    name = "smsc";

    async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
        let okMsg = "Sent Successfully.";
        try {
            let config = {
                headers: {
                    "Content-Type": "application/json",
                    "Accept": "text/json",
                }
            };

            let getArray = [
                "fmt=3",
                "translit=" + notification.smscTranslit,
                "login=" + notification.smscLogin,
                "psw=" + notification.smscPassword,
                "phones=" + notification.smscToNumber,
                "mes=" + encodeURIComponent(msg.replace(/[^\x00-\x7F]/g, "")),
            ];
            if (notification.smscSenderName !== "") {
                getArray.push("sender=" + notification.smscSenderName);
            }

            let resp = await axios.get("https://smsc.kz/sys/send.php?" + getArray.join("&"), config);
            if (resp.data.id === undefined) {
                let error = `Something gone wrong. Api returned code ${resp.data.error_code}: ${resp.data.error}`;
                this.throwGeneralAxiosError(error);
            }

            return okMsg;
        } catch (error) {
            this.throwGeneralAxiosError(error);
        }
    }