diff --git a/src/services/Provider.ts b/src/services/Provider.ts index 5d207161..c886fe14 100644 --- a/src/services/Provider.ts +++ b/src/services/Provider.ts @@ -1,6 +1,6 @@ import Web3 from 'web3' import fetch from 'cross-fetch' -import { LoggerInstance, getData } from '../utils' +import { LoggerInstance } from '../utils' import { FileMetadata, ComputeJob, @@ -21,7 +21,7 @@ export class Provider { */ async getEndpoints(providerUri: string): Promise { try { - const endpoints = await getData(providerUri) + const endpoints = await this.getData(providerUri) return await endpoints.json() } catch (e) { LoggerInstance.error('Finding the service endpoints failed:', e) @@ -802,6 +802,15 @@ export class Provider { } return { valid: true, output: match[1] } } + + private async getData(url: string): Promise { + return fetch(url, { + method: 'GET', + headers: { + 'Content-type': 'application/json' + } + }) + } } export const ProviderInstance = new Provider() diff --git a/src/utils/FetchHelper.ts b/src/utils/FetchHelper.ts index d40d5f54..a21cd181 100644 --- a/src/utils/FetchHelper.ts +++ b/src/utils/FetchHelper.ts @@ -43,15 +43,6 @@ export async function downloadFile( return { data: await response.arrayBuffer(), filename } } -export async function getData(url: string): Promise { - return fetch(url, { - method: 'GET', - headers: { - 'Content-type': 'application/json' - } - }) -} - async function postWithHeaders( url: string, payload: BodyInit,