added more strict checking of http method to Ping service

pull/528/head
Isaac Suttell 2022-08-12 15:45:54 -07:00 committed by Bastien Wirtz
parent db28142374
commit 84930a632b
1 changed files with 7 additions and 1 deletions

View File

@ -29,7 +29,13 @@ export default {
}, },
methods: { methods: {
fetchStatus: async function () { 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) this.fetch("/", { method, cache: "no-cache" }, false)
.then(() => { .then(() => {
this.status = "online"; this.status = "online";