@@ -7,32 +7,31 @@ import {
7
7
} from '@sentry/core' ;
8
8
import { TransportRequestExecutor } from '@sentry/core/dist/transports/base' ;
9
9
import { eventStatusFromHttpCode } from '@sentry/utils' ;
10
- import * as fs from 'fs' ;
11
10
import * as http from 'http' ;
12
11
import * as https from 'https' ;
13
12
14
13
import { HTTPModule } from './base/http-module' ;
15
14
16
- interface HttpTransportOptions extends BaseTransportOptions {
17
- // Todo: doc
18
- headers ?: Record < string , string > ;
19
- // TODO: doc Set a HTTP proxy that should be used for outbound requests.
20
- proxy ?: string ;
21
- // TODO: doc HTTPS proxy certificates path
22
- caCerts ?: string ;
23
- // Todo: doc
24
- httpModule ?: HTTPModule ;
25
- }
26
-
27
15
// TODO(v7):
28
16
// - Rename this file "transports.ts"
29
17
// - Move this file one folder upwards
30
18
// - Delete "transports" folder
31
19
// OR
32
20
// - Split this file up and leave it in the transports folder
33
21
22
+ export interface HttpTransportOptions extends BaseTransportOptions {
23
+ /** Define custom headers */
24
+ headers ?: Record < string , string > ;
25
+ /** Set a proxy that should be used for outbound requests. */
26
+ proxy ?: string ;
27
+ /** HTTPS proxy CA certificates */
28
+ caCerts ?: string | Buffer | Array < string | Buffer > ;
29
+ /** Custom HTTP module */
30
+ httpModule ?: HTTPModule ;
31
+ }
32
+
34
33
/**
35
- * TODO Doc
34
+ * Creates a Transport that uses http to send events to Sentry.
36
35
*/
37
36
export function makeNewHttpTransport ( options : HttpTransportOptions ) : NewTransport {
38
37
// Proxy prioritization: http => `options.proxy` | `process.env.http_proxy`
@@ -49,7 +48,7 @@ export function makeNewHttpTransport(options: HttpTransportOptions): NewTranspor
49
48
}
50
49
51
50
/**
52
- * TODO Doc
51
+ * Creates a Transport that uses https to send events to Sentry.
53
52
*/
54
53
export function makeNewHttpsTransport ( options : HttpTransportOptions ) : NewTransport {
55
54
// Proxy prioritization: https => `options.proxy` | `process.env.https_proxy` | `process.env.http_proxy`
@@ -91,7 +90,7 @@ function applyNoProxyOption(transportUrl: string, proxy: string | undefined): st
91
90
}
92
91
93
92
/**
94
- * TODO Doc
93
+ * Creates a RequestExecutor to be used with `createTransport`.
95
94
*/
96
95
function createRequestExecutor (
97
96
options : HttpTransportOptions ,
@@ -111,7 +110,7 @@ function createRequestExecutor(
111
110
pathname,
112
111
port,
113
112
protocol,
114
- ca : options . caCerts ? fs . readFileSync ( options . caCerts ) : undefined ,
113
+ ca : options . caCerts ,
115
114
} ,
116
115
res => {
117
116
res . on ( 'data' , ( ) => {
0 commit comments