@@ -83,9 +83,7 @@ export class RequestService extends AbstractRequestService implements IRequestSe
83
83
...process . env ,
84
84
...shellEnv
85
85
} ;
86
- const agent = options . agent ? options . agent : await getProxyAgent ( options . url || '' , env , { proxyUrl, strictSSL } ) ;
87
86
88
- options . agent = agent ;
89
87
options . strictSSL = strictSSL ;
90
88
91
89
if ( this . authorization ) {
@@ -95,7 +93,7 @@ export class RequestService extends AbstractRequestService implements IRequestSe
95
93
} ;
96
94
}
97
95
98
- return this . logAndRequest ( options , ( ) => nodeRequest ( options , token ) ) ;
96
+ return this . logAndRequest ( options , ( ) => nodeRequest ( options , proxyUrl , env , token ) ) ;
99
97
}
100
98
101
99
async resolveProxy ( url : string ) : Promise < string | undefined > {
@@ -149,21 +147,23 @@ async function getNodeRequest(options: IRequestOptions): Promise<IRawRequestFunc
149
147
return module . request ;
150
148
}
151
149
152
- export async function nodeRequest ( options : NodeRequestOptions , token : CancellationToken ) : Promise < IRequestContext > {
150
+ export async function nodeRequest ( options : NodeRequestOptions , proxyUrl : string | undefined , env : { [ key : string ] : string | undefined } , token : CancellationToken ) : Promise < IRequestContext > {
153
151
return Promises . withAsyncBody < IRequestContext > ( async ( resolve , reject ) => {
154
152
const endpoint = parseUrl ( options . url ! ) ;
155
153
const rawRequest = options . getRawRequest
156
154
? options . getRawRequest ( options )
157
155
: await getNodeRequest ( options ) ;
158
156
157
+ const proxyAgent = options . agent ? options . agent : await getProxyAgent ( options . url || '' , env , { proxyUrl, strictSSL : options . strictSSL } ) ;
158
+
159
159
const opts : https . RequestOptions & { cache ?: 'default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached' } = {
160
160
hostname : endpoint . hostname ,
161
161
port : endpoint . port ? parseInt ( endpoint . port ) : ( endpoint . protocol === 'https:' ? 443 : 80 ) ,
162
162
protocol : endpoint . protocol ,
163
163
path : endpoint . path ,
164
164
method : options . type || 'GET' ,
165
165
headers : options . headers ,
166
- agent : options . agent ,
166
+ agent : proxyAgent ,
167
167
rejectUnauthorized : isBoolean ( options . strictSSL ) ? options . strictSSL : true
168
168
} ;
169
169
@@ -182,7 +182,7 @@ export async function nodeRequest(options: NodeRequestOptions, token: Cancellati
182
182
...options ,
183
183
url : res . headers [ 'location' ] ,
184
184
followRedirects : followRedirects - 1
185
- } , token ) . then ( resolve , reject ) ;
185
+ } , proxyUrl , env , token ) . then ( resolve , reject ) ;
186
186
} else {
187
187
let stream : streams . ReadableStreamEvents < Uint8Array > = res ;
188
188
0 commit comments