MCPcopy Index your code
hub / github.com/codeaashu/claude-code / createAxiosInstance

Function createAxiosInstance

src/utils/proxy.ts:168–192  ·  view source on GitHub ↗
(
  extra: HttpsProxyAgentOptions<string> = {},
)

Source from the content-addressed store, hash-verified

166 * scoped to this instance.
167 */
168export function createAxiosInstance(
169 extra: HttpsProxyAgentOptions<string> = {},
170): AxiosInstance {
171 const proxyUrl = getProxyUrl()
172 const mtlsAgent = getMTLSAgent()
173 const instance = axios.create({ proxy: false })
174
175 if (!proxyUrl) {
176 if (mtlsAgent) instance.defaults.httpsAgent = mtlsAgent
177 return instance
178 }
179
180 const proxyAgent = createHttpsProxyAgent(proxyUrl, extra)
181 instance.interceptors.request.use(config => {
182 if (config.url && shouldBypassProxy(config.url)) {
183 config.httpsAgent = mtlsAgent
184 config.httpAgent = mtlsAgent
185 } else {
186 config.httpsAgent = proxyAgent
187 config.httpAgent = proxyAgent
188 }
189 return config
190 })
191 return instance
192}
193
194/**
195 * Get or create a memoized proxy agent for the given URI

Callers 1

CCRClientClass · 0.85

Calls 4

getProxyUrlFunction · 0.85
createHttpsProxyAgentFunction · 0.85
shouldBypassProxyFunction · 0.85
createMethod · 0.65

Tested by

no test coverage detected