diff --git a/src/hooks/proxy.ts b/src/hooks/proxy.ts index 87a609d..e16f98a 100644 --- a/src/hooks/proxy.ts +++ b/src/hooks/proxy.ts @@ -1,7 +1,7 @@ import { Options, type Agents } from 'got'; import http2, { auto } from 'http2-wrapper'; import { URL } from 'node:url'; -import { HttpRegularProxyAgent, HttpsProxyAgent } from '../agent/h1-proxy-agent.js'; +import { HttpProxyAgent, HttpRegularProxyAgent, HttpsProxyAgent } from '../agent/h1-proxy-agent.js'; import { TransformHeadersAgent } from '../agent/transform-headers-agent.js'; const { @@ -87,7 +87,7 @@ async function getAgents(parsedProxyUrl: URL, rejectUnauthorized: boolean) { } else { // Upstream proxies hang up connections on CONNECT + unsecure HTTP agent = { - http: new TransformHeadersAgent(new HttpRegularProxyAgent(nativeOptions)), + http: new TransformHeadersAgent(new HttpProxyAgent(nativeOptions)), https: new TransformHeadersAgent(new HttpsProxyAgent(nativeOptions)), http2: new Http2OverHttps(wrapperOptions), }; diff --git a/test/proxy.test.ts b/test/proxy.test.ts index 9ec5de0..27a1ba9 100644 --- a/test/proxy.test.ts +++ b/test/proxy.test.ts @@ -4,6 +4,7 @@ import { jest } from '@jest/globals'; import { HttpsProxyAgent, HttpRegularProxyAgent, + HttpProxyAgent, } from '../src/agent/h1-proxy-agent.js'; import { proxyHook } from '../src/hooks/proxy.js'; @@ -96,7 +97,7 @@ describe('Proxy', () => { const { agent } = options; expect(agent.http).toBeInstanceOf(TransformHeadersAgent); - expect((agent.http as any).agent).toBeInstanceOf(HttpRegularProxyAgent); + expect((agent.http as any).agent).toBeInstanceOf(HttpProxyAgent); }); test('should support https request over https proxy', async () => {