Fix "TypeError: fetch is not a function" in Node.js environment (#1052)
This commit is contained in:
parent
b6a6f52ad8
commit
66d83db51b
|
@ -32,7 +32,7 @@ import config from './config';
|
||||||
*/
|
*/
|
||||||
function HKP(keyServerBaseUrl) {
|
function HKP(keyServerBaseUrl) {
|
||||||
this._baseUrl = keyServerBaseUrl || config.keyserver;
|
this._baseUrl = keyServerBaseUrl || config.keyserver;
|
||||||
this._fetch = typeof global !== 'undefined' ? global.fetch : require('node-fetch');
|
this._fetch = typeof global.fetch === 'function' ? global.fetch : require('node-fetch');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user