2025-12-07 22:46:02 +01:00
|
|
|
import { ProxyAgent } from "undici";
|
|
|
|
|
|
|
|
|
|
export function makeProxyFetch(proxyUrl: string): typeof fetch {
|
|
|
|
|
const agent = new ProxyAgent(proxyUrl);
|
|
|
|
|
return (input: RequestInfo | URL, init?: RequestInit) =>
|
2025-12-08 01:48:53 +01:00
|
|
|
fetch(input, { ...(init ?? {}), dispatcher: agent });
|
2025-12-07 22:46:02 +01:00
|
|
|
}
|
2025-12-08 11:04:17 +01:00
|
|
|
// @ts-nocheck
|