Log correct url
This commit is contained in:
@@ -8,8 +8,9 @@ import axios from "axios";
|
||||
*/
|
||||
export async function sendHeartbeat(url: string, performance?: number, debug: boolean = false) {
|
||||
const useUrl = new URL(url);
|
||||
const parsedURL = `${useUrl.origin}/${useUrl.pathname}?status=up&msg=OK${performance ? `&ping=${performance}` : ""}`;
|
||||
try {
|
||||
const response = await axios.get(`${useUrl.origin}/${useUrl.pathname}?status=up&msg=OK${performance ? `&ping=${performance}` : ""}`);
|
||||
const response = await axios.get(parsedURL);
|
||||
if (debug)
|
||||
console.log(
|
||||
`[eu.astrogd.uptime-kuma-push-monitor] (${new Date().toISOString()}) <${url}>: ${response.status} ${response.statusText}`
|
||||
@@ -27,8 +28,9 @@ export async function sendHeartbeat(url: string, performance?: number, debug: bo
|
||||
*/
|
||||
export async function sendDownNotification(url: string, msg: string = "Error",debug: boolean = false) {
|
||||
const useUrl = new URL(url);
|
||||
const parsedURL = `${useUrl.origin}/${useUrl.pathname}?status=DOWN&msg=${msg}`;
|
||||
try {
|
||||
const response = await axios.get(`${useUrl.origin}/${useUrl.pathname}?status=DOWN&msg=${msg}`);
|
||||
const response = await axios.get(parsedURL);
|
||||
if (debug)
|
||||
console.log(
|
||||
`[eu.astrogd.uptime-kuma-push-monitor] (${new Date().toISOString()}) <${url}>: ${response.status} ${response.statusText}`
|
||||
|
||||
Reference in New Issue
Block a user