
























@@ -164,6 +164,7 @@ describe("ensureGlobalUndiciStreamTimeouts", () => {
164164expect(next.options).toEqual({
165165bodyTimeout: 1_900_000,
166166headersTimeout: 1_900_000,
167+allowH2: false,
167168connect: {
168169autoSelectFamily: false,
169170autoSelectFamilyAttemptTimeout: 300,
@@ -184,6 +185,7 @@ describe("ensureGlobalUndiciStreamTimeouts", () => {
184185expect(next).toBeInstanceOf(EnvHttpProxyAgent);
185186expect(next.options?.bodyTimeout).toBe(DEFAULT_UNDICI_STREAM_TIMEOUT_MS);
186187expect(next.options?.headersTimeout).toBe(DEFAULT_UNDICI_STREAM_TIMEOUT_MS);
188+expect(next.options?.allowH2).toBe(false);
187189expect(next.options?.connect).toEqual({
188190autoSelectFamily: false,
189191autoSelectFamilyAttemptTimeout: 300,
@@ -207,6 +209,7 @@ describe("ensureGlobalUndiciStreamTimeouts", () => {
207209expect(next.options?.httpsProxy).toBe("socks5://proxy.test:1080");
208210expect(next.options?.bodyTimeout).toBe(DEFAULT_UNDICI_STREAM_TIMEOUT_MS);
209211expect(next.options?.headersTimeout).toBe(DEFAULT_UNDICI_STREAM_TIMEOUT_MS);
212+expect(next.options?.allowH2).toBe(false);
210213});
211214212215it("records timeout bridge but does not override unsupported custom proxy dispatcher types", () => {
@@ -281,6 +284,7 @@ describe("ensureGlobalUndiciStreamTimeouts", () => {
281284autoSelectFamily: false,
282285autoSelectFamilyAttemptTimeout: 300,
283286});
287+expect(next.options?.allowH2).toBe(false);
284288});
285289});
286290@@ -299,7 +303,9 @@ describe("ensureGlobalUndiciEnvProxyDispatcher", () => {
299303ensureGlobalUndiciEnvProxyDispatcher();
300304301305expect(setGlobalDispatcher).toHaveBeenCalledTimes(1);
302-expect(getCurrentDispatcher()).toBeInstanceOf(EnvHttpProxyAgent);
306+const next = getCurrentDispatcher() as { options?: Record<string, unknown> };
307+expect(next).toBeInstanceOf(EnvHttpProxyAgent);
308+expect(next.options?.allowH2).toBe(false);
303309});
304310305311it("installs EnvHttpProxyAgent with explicit ALL_PROXY fallback options", () => {
@@ -317,6 +323,7 @@ describe("ensureGlobalUndiciEnvProxyDispatcher", () => {
317323expect(next.options).toEqual({
318324httpProxy: "socks5://proxy.test:1080",
319325httpsProxy: "socks5://proxy.test:1080",
326+allowH2: false,
320327});
321328});
322329@@ -413,6 +420,7 @@ describe("forceResetGlobalDispatcher", () => {
413420expect((getCurrentDispatcher() as { options?: Record<string, unknown> }).options).toEqual({
414421httpProxy: "http://proxy-b.example:8080",
415422httpsProxy: "http://proxy-b.example:8080",
423+allowH2: false,
416424});
417425});
418426@@ -431,6 +439,7 @@ describe("forceResetGlobalDispatcher", () => {
431439expect((getCurrentDispatcher() as { options?: Record<string, unknown> }).options).toEqual({
432440httpProxy: "http://proxy-all.example:3128",
433441httpsProxy: "http://proxy-all.example:3128",
442+allowH2: false,
434443});
435444});
436445});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。