// eslint-disable-next-line filenames/match-exported import { isBrowser } from '@modern-js/utils'; import { createRequest as browser } from './browser'; import { createRequest as node } from './node'; export type BFFRequestPayload = { params?: Record; query?: Record; body?: string; formUrlencoded?: never; formData?: FormData; data?: Record; headers?: Record; cookies?: Record; }; export type Fetcher = typeof fetch; export type Sender = ((...args: any[]) => Promise) & { fetch?: Fetcher; }; export type RequestCreator = ( path: string, method: string, port: number, fetch?: Fetcher, headerWhiteList?: string[], ) => Sender; const createRequest: RequestCreator = (...args) => isBrowser() ? browser(...args) : node(...args); export default createRequest;