Skip to content

Commit 3d17ca8

Browse files
author
anatolybolshakov
committed
Merge remote-tracking branch 'origin/master' into Localization
2 parents 7570ca5 + 5dbfaf3 commit 3d17ca8

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "azure-pipelines-tool-lib",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"description": "Azure Pipelines Tool Installer Lib for CI/CD Tasks",
55
"main": "tool.js",
66
"scripts": {

tool.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,17 @@ export function findLocalToolVersions(toolName: string, arch?: string) {
194194
/**
195195
* Download a tool from an url and stream it into a file
196196
*
197-
* @param url url of tool to download
198-
* @param fileName optional fileName. Should typically not use (will be a guid for reliability). Can pass fileName with an absolute path.
199-
* @param handlers optional handlers array. Auth handlers to pass to the HttpClient for the tool download.
197+
* @param url url of tool to download
198+
* @param fileName optional fileName. Should typically not use (will be a guid for reliability). Can pass fileName with an absolute path.
199+
* @param handlers optional handlers array. Auth handlers to pass to the HttpClient for the tool download.
200+
* @param additionalHeaders optional custom HTTP headers. This is passed to the REST client that downloads the tool.
200201
*/
201-
export async function downloadTool(url: string, fileName?: string, handlers?: ifm.IRequestHandler[]): Promise<string> {
202+
export async function downloadTool(
203+
url: string,
204+
fileName?: string,
205+
handlers?: ifm.IRequestHandler[],
206+
additionalHeaders?: ifm.IHeaders
207+
): Promise<string> {
202208
return new Promise<string>(async (resolve, reject) => {
203209
try {
204210
handlers = handlers || null;
@@ -226,9 +232,9 @@ export async function downloadTool(url: string, fileName?: string, handlers?: if
226232
if (fs.existsSync(destPath)) {
227233
throw new Error("Destination file path already exists");
228234
}
229-
235+
230236
tl.debug('downloading');
231-
let response: httpm.HttpClientResponse = await http.get(url);
237+
let response: httpm.HttpClientResponse = await http.get(url, additionalHeaders);
232238

233239
if (response.message.statusCode != 200) {
234240
let err: Error = new Error('Unexpected HTTP response: ' + response.message.statusCode);

0 commit comments

Comments
 (0)