fix: normalize abort signals for telegram fetch

This commit is contained in:
Peter Steinberger
2026-01-21 16:46:49 +00:00
parent fb164b321e
commit 0e003cb7f1
7 changed files with 88 additions and 24 deletions

View File

@@ -1,10 +1,11 @@
// @ts-nocheck
import { ProxyAgent } from "undici";
import { wrapFetchWithAbortSignal } from "../infra/fetch.js";
export function makeProxyFetch(proxyUrl: string): typeof fetch {
const agent = new ProxyAgent(proxyUrl);
return (input: RequestInfo | URL, init?: RequestInit) => {
return wrapFetchWithAbortSignal((input: RequestInfo | URL, init?: RequestInit) => {
const base = init ? { ...init } : {};
return fetch(input, { ...base, dispatcher: agent });
};
});
}