From: Isaac Suttell Date: Fri, 12 Aug 2022 22:45:54 +0000 (-0700) Subject: added more strict checking of http method to Ping service X-Git-Tag: v22.10.1~3 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=84930a632b7133ad48c3078a2449bb7b82b191d4;p=github%2Fbastienwirtz%2Fhomer.git added more strict checking of http method to Ping service --- diff --git a/src/components/services/Ping.vue b/src/components/services/Ping.vue index 9f4a03d..571c5ad 100644 --- a/src/components/services/Ping.vue +++ b/src/components/services/Ping.vue @@ -29,7 +29,13 @@ export default { }, methods: { fetchStatus: async function () { - const method = typeof this.item.method === 'string' && this.item.method.toLowerCase() === "get" ? "GET" : "HEAD" + const method = typeof this.item.method === 'string' ? this.item.method.toUpperCase() : 'unknown'; + + if (!['GET', 'HEAD', 'OPTION'].includes(method)) { + console.error(`Ping: ${method} is not a supported HTTP method`); + return; + } + this.fetch("/", { method, cache: "no-cache" }, false) .then(() => { this.status = "online";