mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
extra check
This commit is contained in:
parent
17e61d0108
commit
48cb847082
@ -284,13 +284,17 @@ export class Provider extends Instantiable {
|
||||
return `${this.url}${apiPath}/download`
|
||||
}
|
||||
|
||||
/** Check for a valid provider at URL
|
||||
* @param {String} url
|
||||
* @return {Promise<boolean>} string
|
||||
*/
|
||||
public async isValidProvider(url: string): Promise<boolean> {
|
||||
const fetch = this.ocean.utils.fetch.get(url)
|
||||
await fetch
|
||||
.then((response: Response) => {
|
||||
if (response.ok) {
|
||||
const params = response.json()
|
||||
if (params) return true
|
||||
if (params['provider-address']) return true
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user