


















@@ -218,26 +218,26 @@ describe("slack proxy agent", () => {
218218const options = resolveSlackWebClientOptions();
219219const agent = requireAgent(options);
220220221-expect(agent.constructor.name).toBe("HttpsProxyAgent");
221+expect(agent.constructor.name).toBe("ProxylineNodeProxyAgent");
222222});
223223224-it("adds managed proxy CA trust to Slack env proxy agents", () => {
224+it("creates Slack env proxy agents while managed proxy CA trust is active", () => {
225225const caFile = writeTempCa("slack-managed-proxy-ca");
226226process.env.HTTPS_PROXY = "https://proxy.example.com:8443";
227227process.env.OPENCLAW_PROXY_ACTIVE = "1";
228228process.env.OPENCLAW_PROXY_CA_FILE = caFile;
229229230230const options = resolveSlackWebClientOptions();
231-const agent = requireAgent(options) as { connectOpts?: { ca?: unknown } };
231+const agent = requireAgent(options);
232232233-expect(agent.connectOpts?.ca).toBe("slack-managed-proxy-ca");
233+expect(agent.constructor.name).toBe("ProxylineNodeProxyAgent");
234234});
235235236236it("falls back to HTTP_PROXY when HTTPS_PROXY is not set", () => {
237237process.env.HTTP_PROXY = "http://proxy.example.com:3128";
238238const options = resolveSlackWebClientOptions();
239239240-expect(requireAgent(options).constructor.name).toBe("HttpsProxyAgent");
240+expect(requireAgent(options).constructor.name).toBe("ProxylineNodeProxyAgent");
241241});
242242243243it("does not set agent when no proxy env var is configured", () => {
@@ -260,10 +260,12 @@ describe("slack proxy agent", () => {
260260const options = resolveSlackWebClientOptions();
261261const agent = requireAgent(options);
262262263-// HttpsProxyAgent stores the proxy URL — verify it picked the lower-case one
264-expect((agent as unknown as { proxy: { href: string } }).proxy.href).toContain(
265-"lower.example.com",
266-);
263+// Proxyline stores the effective proxy URL in its resolver.
264+expect(
265+(agent as unknown as { getProxyForUrl: (url: string) => string }).getProxyForUrl(
266+"https://slack.com/",
267+),
268+).toContain("lower.example.com");
267269});
268270269271it("treats empty lowercase https_proxy as authoritative over uppercase", () => {
@@ -279,7 +281,7 @@ describe("slack proxy agent", () => {
279281const options = resolveSlackWriteClientOptions();
280282const agent = requireAgent(options);
281283282-expect(agent.constructor.name).toBe("HttpsProxyAgent");
284+expect(agent.constructor.name).toBe("ProxylineNodeProxyAgent");
283285});
284286285287it("respects NO_PROXY excluding slack.com", () => {
@@ -319,7 +321,7 @@ describe("slack proxy agent", () => {
319321process.env.NO_PROXY = "localhost,.internal.corp";
320322const options = resolveSlackWebClientOptions();
321323322-expect(requireAgent(options).constructor.name).toBe("HttpsProxyAgent");
324+expect(requireAgent(options).constructor.name).toBe("ProxylineNodeProxyAgent");
323325});
324326325327it("degrades gracefully on malformed proxy URL", () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。