|
1 |
| -import { BaseBackend } from '@sentry/core'; |
| 1 | +import { BaseBackend, getEnvelopeEndpointWithUrlEncodedAuth, initAPIDetails } from '@sentry/core'; |
2 | 2 | import { Event, EventHint, Severity, Transport, TransportOptions } from '@sentry/types';
|
3 | 3 | import { makeDsn, resolvedSyncPromise } from '@sentry/utils';
|
4 | 4 |
|
5 | 5 | import { eventFromMessage, eventFromUnknownInput } from './eventbuilder';
|
6 |
| -import { HTTPSTransport, HTTPTransport } from './transports'; |
| 6 | +import { |
| 7 | + HTTPSTransport, |
| 8 | + HTTPTransport, |
| 9 | + makeNewHttpsTransport, |
| 10 | + makeNewHttpTransport, |
| 11 | + NodeTransportOptions, |
| 12 | +} from './transports'; |
7 | 13 | import { NodeOptions } from './types';
|
8 | 14 |
|
9 | 15 | /**
|
@@ -50,9 +56,22 @@ export class NodeBackend extends BaseBackend<NodeOptions> {
|
50 | 56 | if (this._options.transport) {
|
51 | 57 | return new this._options.transport(transportOptions);
|
52 | 58 | }
|
| 59 | + |
| 60 | + const api = initAPIDetails(transportOptions.dsn, transportOptions._metadata, transportOptions.tunnel); |
| 61 | + const url = getEnvelopeEndpointWithUrlEncodedAuth(api.dsn, api.tunnel); |
| 62 | + |
| 63 | + const newTransportOptions: NodeTransportOptions = { |
| 64 | + url, |
| 65 | + headers: transportOptions.headers, |
| 66 | + proxy: transportOptions.httpProxy, |
| 67 | + caCerts: transportOptions.caCerts, |
| 68 | + }; |
| 69 | + |
53 | 70 | if (dsn.protocol === 'http') {
|
| 71 | + this._newTransport = makeNewHttpTransport(newTransportOptions); |
54 | 72 | return new HTTPTransport(transportOptions);
|
55 | 73 | }
|
| 74 | + this._newTransport = makeNewHttpsTransport(newTransportOptions); |
56 | 75 | return new HTTPSTransport(transportOptions);
|
57 | 76 | }
|
58 | 77 | }
|
0 commit comments