Files
zkldi_Tachi/server/src/utils/fetch.ts
T
2021-05-25 17:56:41 +01:00

13 lines
373 B
TypeScript

import nodeFetch from "node-fetch";
const fetch =
process.env.NODE_ENV === "test"
? () => {
throw new Error("Cannot use real fetch inside testing env!");
}
: nodeFetch;
export type NodeFetch = (url: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
export default (fetch as unknown) as NodeFetch;