MCPcopy
hub / github.com/unjs/ofetch / FetchOptions

Interface FetchOptions

src/types.ts:22–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20// --------------------------
21
22export interface FetchOptions<R extends ResponseType = ResponseType, T = any>
23 extends Omit<RequestInit, "body">,
24 FetchHooks<T, R> {
25 baseURL?: string;
26
27 body?: RequestInit["body"] | Record<string, any>;
28
29 ignoreResponseError?: boolean;
30
31 /**
32 * @deprecated use query instead.
33 */
34 params?: Record<string, any>;
35
36 query?: Record<string, any>;
37
38 parseResponse?: (responseText: string) => any;
39
40 responseType?: R;
41
42 /**
43 * @experimental Set to "half" to enable duplex streaming.
44 * Will be automatically set to "half" when using a ReadableStream as body.
45 * @see https://fetch.spec.whatwg.org/#enumdef-requestduplex
46 */
47 duplex?: "half" | undefined;
48
49 /**
50 * Only supported in Node.js >= 18 using undici
51 *
52 * @see https://undici.nodejs.org/#/docs/api/Dispatcher
53 */
54 dispatcher?: InstanceType<typeof import("undici").Dispatcher>;
55
56 /**
57 * Only supported older Node.js versions using node-fetch-native polyfill.
58 */
59 agent?: unknown;
60
61 /** timeout in milliseconds */
62 timeout?: number;
63
64 retry?: number | false;
65
66 /** Delay between retries in milliseconds. */
67 retryDelay?: number | ((context: FetchContext<T, R>) => number);
68
69 /** Default is [408, 409, 425, 429, 500, 502, 503, 504] */
70 retryStatusCodes?: number[];
71}
72
73export interface ResolvedFetchOptions<
74 R extends ResponseType = ResponseType,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…