Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
killagu committed Jul 8, 2024
1 parent a2070f4 commit f7bc9bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/HttpAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions test/HttpClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}]);
},
});

Expand Down

0 comments on commit f7bc9bb

Please sign in to comment.