Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
protected _setupTransport(): Transport {
if (!this._options.dsn) {
// We return the noop transport here in case there is no Dsn.
return super._setupTransport();
}
const dsn = new Dsn(this._options.dsn);
const transportOptions: TransportOptions = {
...this._options.transportOptions,
...(this._options.httpProxy && { httpProxy: this._options.httpProxy }),
...(this._options.httpsProxy && { httpsProxy: this._options.httpsProxy }),
...(this._options.caCerts && { caCerts: this._options.caCerts }),
dsn: this._options.dsn,
};
if (this._options.transport) {
return new this._options.transport(transportOptions);
}
if (dsn.protocol === 'http') {
return new HTTPTransport(transportOptions);
}
return new HTTPSTransport(transportOptions);