@@ -19,7 +19,6 @@ let requestOptions = {
19
19
proxy : tl . getHttpProxyConfiguration ( ) ,
20
20
cert : tl . getHttpCertConfiguration ( )
21
21
} as ifm . IRequestOptions ;
22
- let http : httpm . HttpClient = new httpm . HttpClient ( userAgent , null , requestOptions ) ;
23
22
tl . setResourcePath ( path . join ( __dirname , 'lib.json' ) ) ;
24
23
25
24
export function debug ( message : string ) : void {
@@ -194,10 +193,13 @@ export function findLocalToolVersions(toolName: string, arch?: string) {
194
193
*
195
194
* @param url url of tool to download
196
195
* @param fileName optional fileName. Should typically not use (will be a guid for reliability). Can pass fileName with an absolute path.
196
+ * @param handlers optional handlers array. Auth handlers to pass to the HttpClient for the tool download.
197
197
*/
198
- export async function downloadTool ( url : string , fileName ?: string ) : Promise < string > {
198
+ export async function downloadTool ( url : string , fileName ?: string , handlers ?: ifm . IRequestHandler [ ] ) : Promise < string > {
199
199
return new Promise < string > ( async ( resolve , reject ) => {
200
200
try {
201
+ handlers = handlers || null ;
202
+ let http : httpm . HttpClient = new httpm . HttpClient ( userAgent , handlers , requestOptions ) ;
201
203
tl . debug ( fileName ) ;
202
204
fileName = fileName || uuidV4 ( ) ;
203
205
@@ -519,8 +521,11 @@ function _createExtractFolder(dest?: string): string {
519
521
*
520
522
* @param url url to scrape
521
523
* @param regex regex to use for version matches
524
+ * @param handlers optional handlers array. Auth handlers to pass to the HttpClient for the tool download.
522
525
*/
523
- export async function scrape ( url : string , regex : RegExp ) : Promise < string [ ] > {
526
+ export async function scrape ( url : string , regex : RegExp , handlers ?: ifm . IRequestHandler [ ] ) : Promise < string [ ] > {
527
+ handlers = handlers || null ;
528
+ let http : httpm . HttpClient = new httpm . HttpClient ( userAgent , handlers , requestOptions ) ;
524
529
let output : string = await ( await http . get ( url ) ) . readBody ( ) ;
525
530
526
531
let matches = output . match ( regex ) ;
@@ -556,4 +561,4 @@ function _getAgentTemp(): string {
556
561
}
557
562
558
563
return tempDirectory ;
559
- }
564
+ }
0 commit comments