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

Code before:
    name = "SevenIO";

    /**
     * @inheritdoc
     */
    async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
        const okMsg = "Sent Successfully.";

        const data = {
            to: notification.sevenioTo,
            from: notification.sevenioSender || "Uptime Kuma",
            text: msg,
        };

        const axios = Axios.create({
            baseURL: "https://gateway.seven.io/api/",
            headers: {
                "Content-Type": "application/json",
                "X-API-Key": notification.sevenioApiKey,
            },
        });

        try {
            // testing or certificate expiry notification
            if (heartbeatJSON == null) {
                await axios.post("sms", data);
                return okMsg;
            }

            let address = "";

            switch (monitorJSON["type"]) {
                case "ping":
                    address = monitorJSON["hostname"];
                    break;
                case "port":
                case "dns":
                case "gamedig":
                case "steam":
                    address = monitorJSON["hostname"];
                    if (monitorJSON["port"]) {
                        address += ":" + monitorJSON["port"];
                    }
                    break;
                default:
                    if (![ "https://", "http://", "" ].includes(monitorJSON["url"])) {
                        address = monitorJSON["url"];
                    }
                    break;
            }


Review comment (suggestion):
```suggestion
                await axios.post("sms", data, config);
```

Code after:

    /**
     * @inheritdoc
     */
    async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
        const okMsg = "Sent Successfully.";

        const data = {
            to: notification.sevenioTo,
            from: notification.sevenioSender || "Uptime Kuma",
            text: msg,
        };

        const config = {
            baseURL: "https://gateway.seven.io/api/",
            headers: {
                "Content-Type": "application/json",
                "X-API-Key": notification.sevenioApiKey,
            },
        };

        try {
            // testing or certificate expiry notification
            if (heartbeatJSON == null) {
                await axios.post("sms", data, config);
                return okMsg;
            }

            let address = "";

            switch (monitorJSON["type"]) {
                case "ping":
                    address = monitorJSON["hostname"];
                    break;
                case "port":
                case "dns":
                case "gamedig":
                case "steam":
                    address = monitorJSON["hostname"];
                    if (monitorJSON["port"]) {
                        address += ":" + monitorJSON["port"];
                    }
                    break;
                default:
                    if (![ "https://", "http://", "" ].includes(monitorJSON["url"])) {
                        address = monitorJSON["url"];
                    }
                    break;
            }

            if (address !== "") {