Skip to content

Commit

Permalink
Merge pull request #95 from jonathansampson/issue-93
Browse files Browse the repository at this point in the history
Fix #93
  • Loading branch information
AndreiIgna authored Feb 4, 2023
2 parents f7df16b + b31ba00 commit 15e2415
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/whoiser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down Expand Up @@ -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`
Expand Down
6 changes: 6 additions & 0 deletions test/domains.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 15e2415

Please sign in to comment.