mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 20:54:33 +00:00
fix: align proxy fetch typing
This commit is contained in:
@@ -5,10 +5,10 @@ export function makeProxyFetch(proxyUrl: string): typeof fetch {
|
|||||||
const agent = new ProxyAgent(proxyUrl);
|
const agent = new ProxyAgent(proxyUrl);
|
||||||
// undici's fetch is runtime-compatible with global fetch but the types diverge
|
// undici's fetch is runtime-compatible with global fetch but the types diverge
|
||||||
// on stream/body internals. Single cast at the boundary keeps the rest type-safe.
|
// on stream/body internals. Single cast at the boundary keeps the rest type-safe.
|
||||||
const fetcher = (input: RequestInfo | URL, init?: RequestInit) =>
|
const fetcher = ((input: RequestInfo | URL, init?: RequestInit) =>
|
||||||
undiciFetch(input as string | URL, {
|
undiciFetch(input as string | URL, {
|
||||||
...(init as Record<string, unknown>),
|
...(init as Record<string, unknown>),
|
||||||
dispatcher: agent,
|
dispatcher: agent,
|
||||||
}) as unknown as Promise<Response>;
|
}) as unknown as Promise<Response>) as typeof fetch;
|
||||||
return wrapFetchWithAbortSignal(fetcher);
|
return wrapFetchWithAbortSignal(fetcher);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user