MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / resolveNoProxy

Function resolveNoProxy

packages/agent-core/src/utils/proxy.ts:132–145  ·  view source on GitHub ↗
(env: Env = process.env)

Source from the content-addressed store, hash-verified

130 * through the proxy.
131 */
132export function resolveNoProxy(env: Env = process.env): string {
133 // Prefer the first non-blank casing; an empty `no_proxy=''` must not mask a
134 // populated `NO_PROXY` (`??` would, since `''` is not nullish).
135 const raw = [env['no_proxy'], env['NO_PROXY']].find((value) => (value?.trim() ?? '').length > 0) ?? '';
136 const hosts = raw
137 .split(',')
138 .map((host) => host.trim())
139 .filter((host) => host.length > 0);
140 if (hosts.includes('*')) return '*';
141 for (const loopback of LOOPBACK_NO_PROXY) {
142 if (!hosts.includes(loopback)) hosts.push(loopback);
143 }
144 return hosts.join(',');
145}
146
147/**
148 * Build a predicate that returns true when a host (and optional port) should

Callers 4

proxy.test.tsFile · 0.90
createProxyDispatcherFunction · 0.85
proxyEnvForChildFunction · 0.85
reconcileChildNoProxyFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected