fix(core): update

This commit is contained in:
2020-06-25 22:45:19 +00:00
parent 752bbd74b0
commit c5f8e36104
9 changed files with 3432 additions and 1238 deletions

View File

@ -4,6 +4,20 @@ import * as plugins from './webrequest.plugins';
* web request
*/
export class WebRequest {
private static polyfillsLoaded = false;
public static loadNeededPolyfills() {
if (!this.polyfillsLoaded) {
this.polyfillsLoaded = true;
// tslint:disable-next-line: no-eval
const loadFetchPolyfill = eval(`globalThis.fetch = require('node-fetch')`);
loadFetchPolyfill();
}
}
constructor() {
WebRequest.loadNeededPolyfills();
}
public async getJson(urlArg: string | string[]) {
const response: Response = await this.request(urlArg, {
method: 'GET'