diff --git a/src/whoiser.js b/src/whoiser.js index b3abf96..d8a9912 100644 --- a/src/whoiser.js +++ b/src/whoiser.js @@ -120,8 +120,8 @@ const whoisTld = async (query, { timeout = 15000, raw = false, domainThirdLevel return data } -const whoisDomain = async (domain, { host = null, timeout = 15000, follow = 2, raw = false } = {}) => { - domain = punycode.toASCII(domain) +const whoisDomain = async (rawDomain, { host = null, timeout = 15000, follow = 2, raw = false } = {}) => { + domain = punycode.toASCII(rawDomain) const domainThirdLevel = domain.lastIndexOf('.') !== domain.indexOf('.') const [domainName, domainTld] = splitStringBy(domain.toLowerCase(), domain.lastIndexOf('.')) let results = {} @@ -151,7 +151,7 @@ const whoisDomain = async (domain, { host = null, timeout = 15000, follow = 2, r // hardcoded WHOIS queries.. if (host === 'whois.denic.de') { - query = `-T dn ${query}` + query = `-T dn ${rawDomain}` } if (host === 'whois.jprs.jp') { query = `${query}/e` diff --git a/test/domains.js b/test/domains.js index f7b2ccf..3b5d360 100644 --- a/test/domains.js +++ b/test/domains.js @@ -46,6 +46,12 @@ describe('#whoiser.domain()', function() { }); */ + it('should return WHOIS for "de" when domain includes an umlaut', async function () { + // https://github.com/LayeredStudio/whoiser/issues/93 + const whois = await whoiser.domain('testä.de', { follow: 1 }) + assert.notEqual(whois['whois.denic.de']['Domain Status'], 'invalid', 'Domain Status is reported as invalid') + }); + it('returns WHOIS for "netflix.io" with correct registrar WHOIS server', async function() { let whois = await whoiser.domain('netflix.io', {follow: 1}) assert.equal(whois['whois.nic.io']['Registrar WHOIS Server'], 'whois.markmonitor.com', 'Parsing error for WHOIS server')