File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -152,9 +152,9 @@ export function normalizeRequestArgs(
152
152
// Worst case we end up populating protocol with undefined, which it already is
153
153
/* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any */
154
154
requestOptions . protocol =
155
+ ( httpModule ?. globalAgent as any ) ?. protocol ||
155
156
( requestOptions . agent as any ) ?. protocol ||
156
- ( requestOptions . _defaultAgent as any ) ?. protocol ||
157
- ( httpModule ?. globalAgent as any ) ?. protocol ;
157
+ ( requestOptions . _defaultAgent as any ) ?. protocol
158
158
/* eslint-enable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any */
159
159
}
160
160
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { parseSemver } from '@sentry/utils';
6
6
import * as http from 'http' ;
7
7
import * as https from 'https' ;
8
8
import * as nock from 'nock' ;
9
+ import * as HttpsProxyAgent from "https-proxy-agent" ;
9
10
10
11
import { Breadcrumb } from '../../src' ;
11
12
import { NodeClient } from '../../src/client' ;
@@ -175,4 +176,31 @@ describe('default protocols', () => {
175
176
const b = await p ;
176
177
expect ( b . data ?. url ) . toEqual ( expect . stringContaining ( 'https://' ) ) ;
177
178
} ) ;
179
+
180
+ it ( 'makes https request over http proxy' , async ( ) => {
181
+ const key = 'catcatchers' ;
182
+ const p = captureBreadcrumb ( key ) ;
183
+ let nockProtocol = 'https:' ;
184
+
185
+ const proxy = "http://<PROXY_URL>:3128" ;
186
+ const agent = new HttpsProxyAgent ( proxy ) ;
187
+
188
+ if ( NODE_VERSION . major && NODE_VERSION . major < 9 ) {
189
+ nockProtocol = 'http:' ;
190
+ }
191
+
192
+ nock ( `${ nockProtocol } ://${ key } .ingest.sentry.io` )
193
+ . get ( '/api/123122332/store/' )
194
+ . reply ( 200 ) ;
195
+
196
+ https . get ( {
197
+ host : `${ key } .ingest.sentry.io` ,
198
+ path : '/api/123122332/store/' ,
199
+ timeout : 300 ,
200
+ agent
201
+ } ) ;
202
+
203
+ const b = await p ;
204
+ expect ( b . data ?. url ) . toEqual ( expect . stringContaining ( 'https://' ) ) ;
205
+ } )
178
206
} ) ;
You can’t perform that action at this time.
0 commit comments