I'm not sure how to test it without adding significantly more complex logic to the dns.lookup mock, and I'm not sure if you'd want that? For now I've just updated the existing tests that cover this, and they still seem to pass happily.
I have tested this manually, using the /etc/hosts configuration and repro code from #42. With this change, the code there now returns the expected result: returning the same IPv6 result as dns.lookup('localhost', { family: 6 }.
I'm not totally confident that double-requesting like this won't produce some other strange side-effects in other edge cases. I'm not really familiar with this codebase or the oddities of the DNS API, so a detailed review would be very helpful!
This fixes #42.
I'm not sure how to test it without adding significantly more complex logic to the dns.lookup mock, and I'm not sure if you'd want that? For now I've just updated the existing tests that cover this, and they still seem to pass happily.
I have tested this manually, using the /etc/hosts configuration and repro code from #42. With this change, the code there now returns the expected result: returning the same IPv6 result as
dns.lookup('localhost', { family: 6 }
.I'm not totally confident that double-requesting like this won't produce some other strange side-effects in other edge cases. I'm not really familiar with this codebase or the oddities of the DNS API, so a detailed review would be very helpful!