From d7ec7e87b6ad343f5b162a09327edcda8ef063be Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Sun, 30 Jun 2024 09:06:49 -0700 Subject: [PATCH] add TODOs --- lib/install.js | 2 ++ test/proxy-bcrypt.test.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/install.js b/lib/install.js index 84b0e959..0ab4a979 100644 --- a/lib/install.js +++ b/lib/install.js @@ -56,11 +56,13 @@ function place_binary(uri, targetDir, opts, callback) { process.env.npm_config_proxy; let agent; if (proxyUrl) { + // TODO: replace with undici's ProxyAgent const { HttpsProxyAgent } = require('https-proxy-agent'); agent = new HttpsProxyAgent(proxyUrl); log.http('download', 'proxy agent configured using: "%s"', proxyUrl); } + // TODO: use node's built-in fetch fetch(sanitized, { agent }) .then((res) => { if (!res.ok) { diff --git a/test/proxy-bcrypt.test.js b/test/proxy-bcrypt.test.js index 72c43c4a..6bed2953 100644 --- a/test/proxy-bcrypt.test.js +++ b/test/proxy-bcrypt.test.js @@ -44,6 +44,7 @@ test('setup proxy server', (t) => { proxy.startServer({ port: proxyPort }); process.env.https_proxy = process.env.http_proxy = proxyServer; + // TODO: replace with undici's ProxyAgent options.agent = new HttpsProxyAgent(proxyServer); // make sure the download directory deleted then create an empty one @@ -65,6 +66,7 @@ test('verify node fetch with a proxy successfully downloads bcrypt pre-built', ( const url = 'https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-linux-x64-glibc.tar.gz'; async function getBcrypt() { + // TODO: use node's built-in fetch const res = await fetch(url, options); if (res.status !== 200) { throw new Error(`fetch got error ${res.status}`);