mirror of
https://github.com/zkldi/Tachi.git
synced 2026-09-30 10:58:07 +03:00
14 lines
375 B
TypeScript
14 lines
375 B
TypeScript
import { Environment } from "lib/setup/config";
|
|
import nodeFetch from "node-fetch";
|
|
|
|
const fetch =
|
|
Environment.nodeEnv === "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;
|