From 6821e664b0e8aada409471d31a705f2e7ea0c25d Mon Sep 17 00:00:00 2001 From: CosminPerRam Date: Sat, 26 Apr 2025 15:06:49 +0300 Subject: [PATCH] feat(protocol/brokeprotocol): replace explicit got usage (#689) * feat(protocols/brokeprotocol): replace explicit got usage * dont overcomplicate things, it should always be ok * docs: fix return type for checkApi * feat: restore limit 0 --- protocols/brokeprotocolmaster.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/protocols/brokeprotocolmaster.js b/protocols/brokeprotocolmaster.js index d9b0298..99c052a 100644 --- a/protocols/brokeprotocolmaster.js +++ b/protocols/brokeprotocolmaster.js @@ -1,5 +1,4 @@ import Core from './core.js' -import got from 'got' // import Ajv from 'ajv' // const ajv = new Ajv() @@ -123,16 +122,17 @@ export default class brokeprotocolmaster extends Core { /** * Checks if the API is available - * @returns a list of servers as raw data + * @returns a boolean representing api availability */ async checkApi () { try { - const response = await got(this.backendApiUriCheck, { + await this.request({ + url: this.backendApiUriCheck, method: 'HEAD', - timeout: { request: 2000 }, - retry: { limit: 0 } + retry: { limit: 0 } // TODO: #650 remove this }) - return !!response?.ok + + return true } catch (err) { // ignore error message }