@@ -11,6 +11,12 @@ import FormData from 'form-data';
11
11
import http , { ClientRequest , IncomingMessage } from 'http' ;
12
12
import https from 'https' ;
13
13
import { Readable } from 'stream' ;
14
+
15
+ export interface BacktraceNodeRequestHandlerOptions {
16
+ readonly timeout ?: number ;
17
+ readonly ignoreSslCertificate ?: boolean ;
18
+ }
19
+
14
20
export class BacktraceNodeRequestHandler implements BacktraceRequestHandler {
15
21
private readonly UPLOAD_FILE_NAME = 'upload_file' ;
16
22
private readonly _timeout : number ;
@@ -24,15 +30,8 @@ export class BacktraceNodeRequestHandler implements BacktraceRequestHandler {
24
30
'Transfer-Encoding' : 'chunked' ,
25
31
} ;
26
32
27
- constructor (
28
- private readonly _options : {
29
- url : string ;
30
- token ?: string ;
31
- timeout ?: number ;
32
- ignoreSslCertificate ?: boolean ;
33
- } ,
34
- ) {
35
- this . _timeout = this . _options . timeout ?? DEFAULT_TIMEOUT ;
33
+ constructor ( private readonly _options ?: BacktraceNodeRequestHandlerOptions ) {
34
+ this . _timeout = this . _options ?. timeout ?? DEFAULT_TIMEOUT ;
36
35
}
37
36
38
37
public async postError (
@@ -71,7 +70,7 @@ export class BacktraceNodeRequestHandler implements BacktraceRequestHandler {
71
70
const request = httpClient . request (
72
71
url ,
73
72
{
74
- rejectUnauthorized : this . _options . ignoreSslCertificate === true ,
73
+ rejectUnauthorized : this . _options ? .ignoreSslCertificate === true ,
75
74
timeout : this . _timeout ,
76
75
method : 'POST' ,
77
76
} ,
@@ -129,7 +128,7 @@ export class BacktraceNodeRequestHandler implements BacktraceRequestHandler {
129
128
const request = httpClient . request (
130
129
url ,
131
130
{
132
- rejectUnauthorized : this . _options . ignoreSslCertificate === true ,
131
+ rejectUnauthorized : this . _options ? .ignoreSslCertificate === true ,
133
132
timeout : this . _timeout ,
134
133
method : 'POST' ,
135
134
headers :
0 commit comments