remove node-fetch as runtime dependency

This commit is contained in:
mrjvs
2023-09-27 19:10:32 +02:00
parent de63979e4d
commit 9e2bfedb79
4 changed files with 29 additions and 9 deletions

22
src/fetchers/fetch.ts Normal file
View File

@@ -0,0 +1,22 @@
/**
* This file is a very relaxed definition of the fetch api
* Only containing what we need for it to function.
*/
export type FetchOps = {
headers: Record<string, string>;
method: string;
body: any;
};
export type FetchHeaders = {
get(key: string): string | undefined;
};
export type FetchReply = {
text(): Promise<string>;
json(): Promise<any>;
headers: FetchHeaders;
};
export type FetchType = (url: string, ops?: FetchOps) => Promise<FetchReply>;