From f7bc9bb878e42e56e32ac23dbd18a93ff53b7b9b Mon Sep 17 00:00:00 2001 From: killagu Date: Mon, 8 Jul 2024 15:59:23 +0800 Subject: [PATCH] f --- src/HttpAgent.ts | 1 - test/HttpClient.test.ts | 10 +++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/HttpAgent.ts b/src/HttpAgent.ts index e8cd3cc..e26eecd 100644 --- a/src/HttpAgent.ts +++ b/src/HttpAgent.ts @@ -42,7 +42,6 @@ export class HttpAgent extends Agent { // address will be array on Node.js >= 20 const address = args[0]; const family = args[1]; - console.log('args: ', args, address, family); if (err) return (callback as any)(err, address, family); if (options.checkAddress) { // dnsOptions.all set to default on Node.js >= 20, dns.lookup will return address array object diff --git a/test/HttpClient.test.ts b/test/HttpClient.test.ts index b92b91e..a9b68e4 100644 --- a/test/HttpClient.test.ts +++ b/test/HttpClient.test.ts @@ -337,13 +337,17 @@ describe('HttpClient.test.ts', () => { let hostname: string; const httpclient = new HttpClient({ checkAddress(ip, family, aHostname) { - console.log('ip: ', ip, family, aHostname); hostname = aHostname; return true; }, lookup(hostname, options, callback) { - console.log('lookup: ', hostname, options); - return callback(null, '127.0.0.1', 4); + if (process.version.startsWith('v18')) { + return callback(null, '127.0.0.1', 4); + } + return callback(null, [{ + address: '127.0.0.1', + family: 4, + }]); }, });