2025-12-08 11:54:30 +01:00
|
|
|
// @ts-nocheck
|
2025-12-07 22:46:02 +01:00
|
|
|
import { ProxyAgent } from "undici";
|
2026-01-21 16:46:49 +00:00
|
|
|
import { wrapFetchWithAbortSignal } from "../infra/fetch.js";
|
2025-12-07 22:46:02 +01:00
|
|
|
|
|
|
|
|
export function makeProxyFetch(proxyUrl: string): typeof fetch {
|
|
|
|
|
const agent = new ProxyAgent(proxyUrl);
|
2026-01-21 16:46:49 +00:00
|
|
|
return wrapFetchWithAbortSignal((input: RequestInfo | URL, init?: RequestInit) => {
|
2025-12-23 00:28:40 +00:00
|
|
|
const base = init ? { ...init } : {};
|
|
|
|
|
return fetch(input, { ...base, dispatcher: agent });
|
2026-01-21 16:46:49 +00:00
|
|
|
});
|
2025-12-07 22:46:02 +01:00
|
|
|
}
|