fix: treat RDAP 404 responses as "domain not found" instead of failure (#29)

This commit is contained in:
Nodar Davituri
2026-01-10 13:26:45 -05:00
committed by GitHub
parent 6ef4291d0e
commit 2ca7ce68ce
3 changed files with 75 additions and 4 deletions
+14 -1
View File
@@ -47,7 +47,20 @@ export async function lookup(
for (const base of bases) {
tried.push(base);
try {
const { json } = await fetchRdapDomain(domain, base, opts);
const { json, notFound } = await fetchRdapDomain(domain, base, opts);
// HTTP 404 = domain not registered
if (notFound) {
const record: DomainRecord = {
domain,
tld,
isRegistered: false,
rdapServers: tried,
source: "rdap",
};
return { ok: true, record };
}
const rdapEnriched = await fetchAndMergeRdapRelated(
domain,
json,