MCPcopy Create free account
hub / github.com/getsentry/sentry-javascript / applyNoProxyOption

Function applyNoProxyOption

packages/node-core/src/transports/http.ts:90–104  ·  view source on GitHub ↗

* Honors the `no_proxy` env variable with the highest priority to allow for hosts exclusion. * * @param transportUrl The URL the transport intends to send events to. * @param proxy The client configured proxy. * @returns A proxy the transport should use.

(transportUrlSegments: URL, proxy: string | undefined)

Source from the content-addressed store, hash-verified

88 * @returns A proxy the transport should use.
89 */
90function applyNoProxyOption(transportUrlSegments: URL, proxy: string | undefined): string | undefined {
91 const { no_proxy } = process.env;
92
93 const urlIsExemptFromProxy = no_proxy
94 ?.split(',')
95 .some(
96 exemption => transportUrlSegments.host.endsWith(exemption) || transportUrlSegments.hostname.endsWith(exemption),
97 );
98
99 if (urlIsExemptFromProxy) {
100 return undefined;
101 } else {
102 return proxy;
103 }
104}
105
106/**
107 * Creates a RequestExecutor to be used with `createTransport`.

Callers 1

makeNodeTransportFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected