MCPcopy Index your code
hub / github.com/di-sukharev/opencommit / setProxyAgentOnRequest

Function setProxyAgentOnRequest

out/cli.cjs:76299–76320  ·  view source on GitHub ↗
(request3, cachedAgents, proxyUrl)

Source from the content-addressed store, hash-verified

76297 if (settings.username) {
76298 parsedProxyUrl.username = settings.username;
76299 }
76300 if (settings.password) {
76301 parsedProxyUrl.password = settings.password;
76302 }
76303 return parsedProxyUrl;
76304}
76305function setProxyAgentOnRequest(request3, cachedAgents, proxyUrl) {
76306 if (request3.agent) {
76307 return;
76308 }
76309 const url2 = new URL(request3.url);
76310 const isInsecure = url2.protocol !== "https:";
76311 if (request3.tlsSettings) {
76312 logger.warning("TLS settings are not supported in combination with custom Proxy, certificates provided to the client will be ignored.");
76313 }
76314 const headers = request3.headers.toJSON();
76315 if (isInsecure) {
76316 if (!cachedAgents.httpProxyAgent) {
76317 cachedAgents.httpProxyAgent = new import_http_proxy_agent.HttpProxyAgent(proxyUrl, { headers });
76318 }
76319 request3.agent = cachedAgents.httpProxyAgent;
76320 } else {
76321 if (!cachedAgents.httpsProxyAgent) {
76322 cachedAgents.httpsProxyAgent = new import_https_proxy_agent2.HttpsProxyAgent(proxyUrl, { headers });
76323 }

Callers 1

sendRequestFunction · 0.85

Calls 1

toJSONMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…