mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
fix (#1166)
This commit is contained in:
parent
602f453985
commit
ec61424546
@ -28,7 +28,7 @@ export class Provider {
|
||||
async getEndpoints(providerUri: string): Promise<any> {
|
||||
try {
|
||||
const endpoints = await getData(providerUri)
|
||||
return endpoints
|
||||
return await endpoints.json()
|
||||
} catch (e) {
|
||||
LoggerInstance.error('Finding the service endpoints failed:', e)
|
||||
return null
|
||||
@ -127,7 +127,7 @@ export class Provider {
|
||||
document: any,
|
||||
providerUri: string,
|
||||
fetchMethod: any
|
||||
): Promise<string> {
|
||||
): Promise<any> {
|
||||
const providerEndpoints = await this.getEndpoints(providerUri)
|
||||
const serviceEndpoints = await this.getServiceEndpoints(
|
||||
providerUri,
|
||||
@ -142,10 +142,11 @@ export class Provider {
|
||||
const path = this.getEndpointURL(serviceEndpoints, 'encrypt')
|
||||
? this.getEndpointURL(serviceEndpoints, 'encrypt').urlPath
|
||||
: null
|
||||
|
||||
if (!path) return null
|
||||
try {
|
||||
const response = await fetchMethod(path, decodeURI(JSON.stringify(args)))
|
||||
return (await response.json()).encryptedDocument
|
||||
return response
|
||||
} catch (e) {
|
||||
LoggerInstance.error(e)
|
||||
throw new Error('HTTP request failed')
|
||||
|
Loading…
x
Reference in New Issue
Block a user