Skip to content

Commit 41e4cd3

Browse files
committed
pass additional headers directly
1 parent dc43159 commit 41e4cd3

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

tool.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,12 @@ export function findLocalToolVersions(toolName: string, arch?: string) {
199199
* @param handlers optional handlers array. Auth handlers to pass to the HttpClient for the tool download.
200200
* @param auth optional custom auth header value. This is passed as a HTTP header to the download client.
201201
*/
202-
export async function downloadTool(url: string, fileName?: string, handlers?: ifm.IRequestHandler[], auth?: string): Promise<string> {
202+
export async function downloadTool(
203+
url: string,
204+
fileName?: string,
205+
handlers?: ifm.IRequestHandler[],
206+
additionalHeaders?: ifm.IHeaders
207+
): Promise<string> {
203208
return new Promise<string>(async (resolve, reject) => {
204209
try {
205210
handlers = handlers || null;
@@ -228,12 +233,6 @@ export async function downloadTool(url: string, fileName?: string, handlers?: if
228233
throw new Error("Destination file path already exists");
229234
}
230235

231-
const additionalHeaders: ifm.IHeaders = {};
232-
if (auth) {
233-
tl.debug('adding authorization header');
234-
additionalHeaders['Authorization'] = auth;
235-
}
236-
237236
tl.debug('downloading');
238237
let response: httpm.HttpClientResponse = await http.get(url, additionalHeaders);
239238

0 commit comments

Comments
 (0)