mirror of
https://github.com/zkldi/Tachi.git
synced 2026-09-29 10:28:04 +03:00
15 lines
445 B
TypeScript
15 lines
445 B
TypeScript
import { Environment } from "lib/setup/config";
|
|
import nodeFetch from "node-fetch";
|
|
import type { RequestInfo, RequestInit, Response } 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;
|