1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

polyfill fetch globals on nodeapi

This commit is contained in:
Kyle Spearrin
2018-05-15 09:02:57 -04:00
parent 17cf059970
commit f173001a41
3 changed files with 16 additions and 3 deletions

View File

@@ -1,11 +1,14 @@
import { Utils } from '../misc/utils';
import * as fe from 'node-fetch';
import { ApiService } from './api.service';
import { PlatformUtilsService } from '../abstractions/platformUtils.service';
import { TokenService } from '../abstractions/token.service';
import * as fetch from 'node-fetch';
(global as any).fetch = fe.default;
(global as any).Request = fe.Request;
(global as any).Response = fe.Response;
(global as any).Headers = fe.Headers;
export class NodeApiService extends ApiService {
constructor(tokenService: TokenService, platformUtilsService: PlatformUtilsService,