fix(proxy): support portable undici dispatcher typings

This commit is contained in:
Tam Nhu Tran
2026-03-17 12:59:18 -04:00
parent 204475627a
commit ee06f83988
+3 -1
View File
@@ -9,6 +9,8 @@ import { Agent, Dispatcher, ProxyAgent, fetch as undiciFetch, setGlobalDispatche
import { getProxyResolution, shouldBypassProxy } from './proxy-env';
const FETCH_PROXY_PROTOCOLS = ['http:', 'https:'];
type RoutingDispatchOptions = Parameters<Dispatcher['dispatch']>[0];
type RoutingDispatchHandler = Parameters<Dispatcher['dispatch']>[1];
type GlobalFetchProxyConfig = {
httpProxyUrl?: string;
@@ -27,7 +29,7 @@ class RoutingProxyDispatcher extends Dispatcher {
this.httpsProxyDispatcher = httpsProxyUrl ? new ProxyAgent(httpsProxyUrl) : null;
}
dispatch(options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean {
dispatch(options: RoutingDispatchOptions, handler: RoutingDispatchHandler): boolean {
return this.resolveDispatcher(options.origin).dispatch(options, handler);
}