| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c2cf978 commit d3e2fc8
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,31 +16,37 @@ const { addresses } = require('../common/internet'); | |||
| 16 | 16 | const fixture = { | |
| 17 | 17 | hostname: 'straße.de', | |
| 18 | 18 | expectedAddress: '81.169.145.78', | |
| 19 | - dnsServer: addresses.DNS4_SERVER | ||
| 19 | + dnsServer: addresses.DNS4_SERVER, | ||
| 20 | + family: 4, | ||
| 20 | 21 | }; | |
| 21 | 22 | ||
| 22 | - // Explicitly use well behaved DNS servers that are known to be able to resolve | ||
| 23 | + // Explicitly use well-behaved DNS servers that are known to be able to resolve | ||
| 23 | 24 | // the query (which is a.k.a xn--strae-oqa.de). | |
| 24 | 25 | dns.setServers([fixture.dnsServer]); | |
| 25 | 26 | ||
| 26 | - dns.lookup(fixture.hostname, mustCall((err, address) => { | ||
| 27 | - if (err && err.errno === 'ESERVFAIL') { | ||
| 28 | - assert.ok(err.message.includes('queryA ESERVFAIL straße.de')); | ||
| 29 | - return; | ||
| 30 | - } | ||
| 31 | - assert.ifError(err); | ||
| 32 | - assert.strictEqual(address, fixture.expectedAddress); | ||
| 33 | - })); | ||
| 27 | + dns.lookup( | ||
| 28 | + fixture.hostname, | ||
| 29 | + { family: fixture.family }, | ||
| 30 | + mustCall((err, address) => { | ||
| 31 | + if (err && err.errno === 'ESERVFAIL') { | ||
| 32 | + assert.ok(err.message.includes('queryA ESERVFAIL straße.de')); | ||
| 33 | + return; | ||
| 34 | + } | ||
| 35 | + assert.ifError(err); | ||
| 36 | + assert.strictEqual(address, fixture.expectedAddress); | ||
| 37 | + }) | ||
| 38 | + ); | ||
| 34 | 39 | ||
| 35 | - dns.promises.lookup(fixture.hostname).then(({ address }) => { | ||
| 36 | - assert.strictEqual(address, fixture.expectedAddress); | ||
| 37 | - }, (err) => { | ||
| 38 | - if (err && err.errno === 'ESERVFAIL') { | ||
| 39 | - assert.ok(err.message.includes('queryA ESERVFAIL straße.de')); | ||
| 40 | - } else { | ||
| 41 | - throw err; | ||
| 42 | - } | ||
| 43 | - }).finally(mustCall()); | ||
| 40 | + dns.promises.lookup(fixture.hostname, { family: fixture.family }) | ||
| 41 | + .then(({ address }) => { | ||
| 42 | + assert.strictEqual(address, fixture.expectedAddress); | ||
| 43 | + }, (err) => { | ||
| 44 | + if (err && err.errno === 'ESERVFAIL') { | ||
| 45 | + assert.ok(err.message.includes('queryA ESERVFAIL straße.de')); | ||
| 46 | + } else { | ||
| 47 | + throw err; | ||
| 48 | + } | ||
| 49 | + }).finally(mustCall()); | ||
| 44 | 50 | ||
| 45 | 51 | dns.resolve4(fixture.hostname, mustCall((err, addresses) => { | |
| 46 | 52 | if (err && err.errno === 'ESERVFAIL') { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments