Skip to content

Commit

Permalink
Accept extra headers in the downloader module
Browse files Browse the repository at this point in the history
  • Loading branch information
alcuadrado committed Dec 29, 2022
1 parent 7404d28 commit b24b994
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/hardhat-core/src/internal/util/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ function resolveTempFileName(filePath: string): string {
export async function download(
url: string,
filePath: string,
timeoutMillis = 10000
timeoutMillis = 10000,
extraHeaders: { [name: string]: string } = {}
) {
const { pipeline } = await import("stream");
const { getGlobalDispatcher, ProxyAgent, request } = await import("undici");
Expand All @@ -47,6 +48,7 @@ export async function download(
maxRedirections: 10,
method: "GET",
headers: {
...extraHeaders,
"User-Agent": `hardhat ${hardhatVersion ?? "(unknown version)"}`,
},
});
Expand Down

0 comments on commit b24b994

Please sign in to comment.