Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "cf-doh", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Typed Cloudflare DNS Over HTTP Resolver", | ||
@@ -5,0 +5,0 @@ "main": "pkg/index.js", |
@@ -230,3 +230,11 @@ "use strict"; | ||
} | ||
return [2 /*return*/, r.Answer.map(function (r) { return r.data; })]; | ||
return [2 /*return*/, r.Answer.map(function (r) { | ||
try { | ||
// Text records are returned wrapped in quotes, parse them to strip the quotes | ||
return JSON.parse(r.data); | ||
} | ||
catch (e) { | ||
return r.data; | ||
} | ||
})]; | ||
} | ||
@@ -233,0 +241,0 @@ }); |
@@ -66,7 +66,11 @@ # cf-doh | ||
const response = await queryDNS("_verification.jesseditson.com", "TXT"); | ||
const response = await queryDNSRecords("_verification.jesseditson.com", "TXT"); | ||
if (response.status === DOHStatus.NoError) { | ||
const records = r.Answer.map((r) => r.data); | ||
const records = r.Answer.map((r) => JSON.parse(r.data)); | ||
} | ||
``` | ||
## Caveats and Notes | ||
Cloudflare returns quoted strings for standardized record types, and hex values for unknown record types. This means that for most records, the string you get back will include double quotes. `queryDNS` uses `JSON.parse()` to strip these quotes before returning them, so if you're using `queryDNSRecords` directly, you'll need to process these values to use them as strings. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
29183
422
76
1