aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIsaac Suttell <isaac@isaacsuttell.com>2022-08-12 15:45:54 -0700
committerBastien Wirtz <bastien.wirtz@gmail.com>2022-10-08 11:53:26 +0200
commit84930a632b7133ad48c3078a2449bb7b82b191d4 (patch)
tree0454c01940f6ed6ecce3a2a5c0ebb9eaf818e9a7
parentdb2814237443bb68c11c728d5206679d3cc38e94 (diff)
downloadhomer-84930a632b7133ad48c3078a2449bb7b82b191d4.tar.gz
homer-84930a632b7133ad48c3078a2449bb7b82b191d4.tar.zst
homer-84930a632b7133ad48c3078a2449bb7b82b191d4.zip
added more strict checking of http method to Ping service
-rw-r--r--src/components/services/Ping.vue8
1 files changed, 7 insertions, 1 deletions
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 {
29 }, 29 },
30 methods: { 30 methods: {
31 fetchStatus: async function () { 31 fetchStatus: async function () {
32 const method = typeof this.item.method === 'string' && this.item.method.toLowerCase() === "get" ? "GET" : "HEAD" 32 const method = typeof this.item.method === 'string' ? this.item.method.toUpperCase() : 'unknown';
33
34 if (!['GET', 'HEAD', 'OPTION'].includes(method)) {
35 console.error(`Ping: ${method} is not a supported HTTP method`);
36 return;
37 }
38
33 this.fetch("/", { method, cache: "no-cache" }, false) 39 this.fetch("/", { method, cache: "no-cache" }, false)
34 .then(() => { 40 .then(() => {
35 this.status = "online"; 41 this.status = "online";