mirror of
https://github.com/tribufu/node-gamedig
synced 2026-05-06 07:07:33 +00:00
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
This commit is contained in:
parent
f760f0c726
commit
6821e664b0
1 changed files with 6 additions and 6 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
import Core from './core.js'
|
import Core from './core.js'
|
||||||
import got from 'got'
|
|
||||||
// import Ajv from 'ajv'
|
// import Ajv from 'ajv'
|
||||||
// const ajv = new Ajv()
|
// const ajv = new Ajv()
|
||||||
|
|
||||||
|
|
@ -123,16 +122,17 @@ export default class brokeprotocolmaster extends Core {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the API is available
|
* Checks if the API is available
|
||||||
* @returns a list of servers as raw data
|
* @returns a boolean representing api availability
|
||||||
*/
|
*/
|
||||||
async checkApi () {
|
async checkApi () {
|
||||||
try {
|
try {
|
||||||
const response = await got(this.backendApiUriCheck, {
|
await this.request({
|
||||||
|
url: this.backendApiUriCheck,
|
||||||
method: 'HEAD',
|
method: 'HEAD',
|
||||||
timeout: { request: 2000 },
|
retry: { limit: 0 } // TODO: #650 remove this
|
||||||
retry: { limit: 0 }
|
|
||||||
})
|
})
|
||||||
return !!response?.ok
|
|
||||||
|
return true
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// ignore error message
|
// ignore error message
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue