@@ -293,7 +293,8 @@ describe('HTTPSTransport', () => {
293
293
dsn,
294
294
httpsProxy : 'https://example.com:8080' ,
295
295
} ) ;
296
- expect ( transport . client ) . toBeInstanceOf ( https . Agent ) ;
296
+ expect ( transport . client ) . toBeInstanceOf ( https . Agent ) ; // rather than HttpsProxyAgent
297
+ delete process . env . no_proxy ;
297
298
} ) ;
298
299
299
300
test ( 'no_proxy works with a port' , async ( ) => {
@@ -302,8 +303,9 @@ describe('HTTPSTransport', () => {
302
303
const transport = createTransport ( {
303
304
dsn,
304
305
} ) ;
305
- expect ( transport . client ) . toBeInstanceOf ( https . Agent ) ;
306
+ expect ( transport . client ) . toBeInstanceOf ( https . Agent ) ; // rather than HttpsProxyAgent
306
307
delete process . env . https_proxy ;
308
+ delete process . env . no_proxy ;
307
309
} ) ;
308
310
309
311
test ( 'no_proxy works with multiple comma-separated hosts' , async ( ) => {
@@ -312,8 +314,9 @@ describe('HTTPSTransport', () => {
312
314
const transport = createTransport ( {
313
315
dsn,
314
316
} ) ;
315
- expect ( transport . client ) . toBeInstanceOf ( https . Agent ) ;
316
- delete process . env . https_proxy ;
317
+ expect ( transport . client ) . toBeInstanceOf ( https . Agent ) ; // rather than HttpsProxyAgent
318
+ delete process . env . http_proxy ;
319
+ delete process . env . no_proxy ;
317
320
} ) ;
318
321
319
322
test ( 'can configure tls certificate through client option' , async ( ) => {
@@ -328,5 +331,20 @@ describe('HTTPSTransport', () => {
328
331
const requestOptions = ( transport . module ! . request as jest . Mock ) . mock . calls [ 0 ] [ 0 ] ;
329
332
expect ( requestOptions . ca ) . toEqual ( 'mockedCert' ) ;
330
333
} ) ;
334
+
335
+ test ( 'can use an http proxy with an https DSN' , async ( ) => {
336
+ const transport = createTransport ( {
337
+ dsn,
338
+ httpProxy : 'https://example.com:8080' ,
339
+ } ) ;
340
+ const client = ( transport . client as unknown ) as { proxy : Record < string , string | number > ; secureProxy : boolean } ;
341
+
342
+ expect ( client ) . toBeInstanceOf ( HttpsProxyAgent ) ;
343
+ expect ( async ( ) => {
344
+ await transport . sendEvent ( {
345
+ message : 'test' ,
346
+ } ) ;
347
+ } ) . not . toThrow ( ) ;
348
+ } ) ;
331
349
} ) ;
332
350
} ) ;
0 commit comments