2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-08 17:22:34 +03:00

fix(dns): fixed lookup error handling; (#6175)

This commit is contained in:
Dmitriy Mozgovoy
2024-01-05 01:48:07 +02:00
committed by GitHub
parent 1f73dcbbe0
commit f4f2b039dd
2 changed files with 13 additions and 0 deletions
+4
View File
@@ -171,6 +171,10 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
// hotfix to support opt.all option which is required for node 20.x
lookup = (hostname, opt, cb) => {
_lookup(hostname, opt, (err, arg0, arg1) => {
if (err) {
return cb(err);
}
const addresses = utils.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);