Skip to content

Commit

Permalink
fix: add if statement to check if given url is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-bisonai committed Nov 8, 2023
1 parent f6a2464 commit 82fa8c4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cli/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export function buildFetcherUrl(host: string, port: string, apiVersion: string)

export async function isOraklNetworkApiHealthy() {
try {

Check failure on line 55 in cli/src/utils.ts

View workflow job for this annotation

GitHub Actions / build-publish

Delete `⏎····`
return 200 === (await axios.get(ORAKL_NETWORK_API_URL))?.status
} catch (e) {
console.error(`Orakl Network API [${ORAKL_NETWORK_API_URL}] is down`)
Expand All @@ -61,6 +62,8 @@ export async function isOraklNetworkApiHealthy() {

export async function isOraklFetcherHealthy(url: string) {
try {
if (!(await isValidUrl(url))) throw new Error('invalid url')

return 200 === (await axios.get(url))?.status
} catch (e) {
console.error(`Orakl Network Fetcher [${url}] is down`)
Expand All @@ -80,6 +83,8 @@ export async function isOraklDelegatorHealthy() {
export async function isServiceHealthy(url: string) {
const healthEndpoint = buildUrl(url, 'health')
try {
if (!(await isValidUrl(url))) throw new Error('invalid url')

Check failure on line 87 in cli/src/utils.ts

View workflow job for this annotation

GitHub Actions / build-publish

Delete `····`
return 200 === (await axios.get(healthEndpoint))?.status
} catch (e) {
console.log(e)
Expand Down

0 comments on commit 82fa8c4

Please sign in to comment.