diff --git a/src/hooks/browser-headers.ts b/src/hooks/browser-headers.ts index e75af53..eb9140b 100644 --- a/src/hooks/browser-headers.ts +++ b/src/hooks/browser-headers.ts @@ -39,12 +39,12 @@ const getResolveProtocolFunction = (options: Options, proxyUrl: string | undefin } if (proxyUrl) { - return createResolveProtocol(proxyUrl, sessionData as any, options?.timeout?.connect ?? options?.timeout?.request); + return createResolveProtocol(proxyUrl, sessionData as any, Math.min(options?.timeout?.connect ?? 60_000, options?.timeout?.request ?? 60_000)); } return (...args: Parameters) => http2.auto.resolveProtocol({ ...args[0], - timeout: options?.timeout?.connect ?? options?.timeout?.request, + timeout: Math.min(options?.timeout?.connect ?? 60_000, options?.timeout?.request ?? 60_000), }); }; diff --git a/src/hooks/http2.ts b/src/hooks/http2.ts index 2231350..c0037da 100644 --- a/src/hooks/http2.ts +++ b/src/hooks/http2.ts @@ -14,7 +14,7 @@ export function http2Hook(options: Options): void { typedRequestOptions.resolveProtocol = createResolveProtocol( proxyUrl, sessionData as any, - options?.timeout?.connect ?? options?.timeout?.request, + Math.min(options?.timeout?.connect ?? 60_000, options?.timeout?.request ?? 60_000), ); }