mirror of
https://github.com/jakejarvis/rdapper.git
synced 2026-09-23 00:15:31 -04:00
fix: treat RDAP 404 responses as "domain not found" instead of failure (#29)
This commit is contained in:
+14
-1
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user