refactor(telegram): avoid double-wrapping proxy fetch

This commit is contained in:
sebslight
2026-02-16 08:24:31 -05:00
parent b4fa10ae67
commit 6931f0fb50
2 changed files with 52 additions and 5 deletions

View File

@@ -1,5 +1,4 @@
import { ProxyAgent, fetch as undiciFetch } from "undici";
import { wrapFetchWithAbortSignal } from "../infra/fetch.js";
export function makeProxyFetch(proxyUrl: string): typeof fetch {
const agent = new ProxyAgent(proxyUrl);
@@ -10,5 +9,7 @@ export function makeProxyFetch(proxyUrl: string): typeof fetch {
...(init as Record<string, unknown>),
dispatcher: agent,
}) as unknown as Promise<Response>) as typeof fetch;
return wrapFetchWithAbortSignal(fetcher);
// Return raw proxy fetch; call sites that need AbortSignal normalization
// should opt into resolveFetch/wrapFetchWithAbortSignal once at the edge.
return fetcher;
}