Comparing version 3.2.0 to 3.2.1
@@ -165,3 +165,3 @@ const debug = require('debug')('dat') | ||
// ensure the name is a FQDN | ||
if (!name.contains('.')) { | ||
if (!name.includes('.')) { | ||
debug('dns-over-https failed', name, 'Not an a FQDN') | ||
@@ -186,2 +186,6 @@ datDns.emit('failed', { | ||
path: `${path}?${stringify(query)}`, | ||
// Cloudflare requires this exact header; luckily everyone else ignores it | ||
headers: { | ||
'Accept': 'application/dns-json' | ||
}, | ||
timeout: 2000 | ||
@@ -188,0 +192,0 @@ }, function (res) { |
{ | ||
"name": "dat-dns", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"description": "Issue DNS lookups for Dat archives using HTTPS requests to the target host.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
16
test.js
@@ -66,3 +66,3 @@ var tape = require('tape') | ||
tape('A bad hostname fails gracefully', function (t) { | ||
datDns.resolveName('example.com', function (err, name) { | ||
datDns.resolveName('example.com', {ignoreCache: true}, function (err, name) { | ||
t.ok(err) | ||
@@ -75,3 +75,3 @@ t.notOk(name) | ||
datDns.resolveName('foo bar', function (err, name) { | ||
datDns.resolveName('foo bar', {ignoreCache: true}, function (err, name) { | ||
t.ok(err) | ||
@@ -87,3 +87,3 @@ t.notOk(name) | ||
tape('A bad DNS record fails gracefully', function (t) { | ||
datDns.resolveName('bad-dat-record1.beakerbrowser.com', function (err, name) { | ||
datDns.resolveName('bad-dat-record1.beakerbrowser.com', {ignoreCache: true}, function (err, name) { | ||
t.ok(err) | ||
@@ -96,3 +96,3 @@ t.notOk(name) | ||
tape('Unqualified domain fails gracefully', function (t) { | ||
datDns.resolveName('bad-dat-domain-name', function (err, name) { | ||
datDns.resolveName('bad-dat-domain-name', {ignoreCache: true}, function (err, name) { | ||
t.ok(err) | ||
@@ -105,3 +105,3 @@ t.notOk(name) | ||
tape('Successful test against beakerbrowser.com', function (t) { | ||
datDns.resolveName('beakerbrowser.com', function (err, name) { | ||
datDns.resolveName('beakerbrowser.com', {ignoreCache: true}, function (err, name) { | ||
t.error(err) | ||
@@ -121,3 +121,3 @@ t.ok(/[0-9a-f]{64}/.test(name)) | ||
tape('Successful test against beakerbrowser.com (no dns-over-https)', function (t) { | ||
datDns.resolveName('beakerbrowser.com', {noDnsOverHttps: true}, function (err, name) { | ||
datDns.resolveName('beakerbrowser.com', {noDnsOverHttps: true, ignoreCache: true}, function (err, name) { | ||
t.error(err) | ||
@@ -137,3 +137,5 @@ t.ok(/[0-9a-f]{64}/.test(name)) | ||
tape('Successful test against beakerbrowser.com (no well-known/dat)', function (t) { | ||
datDns.resolveName('beakerbrowser.com', {noWellknownDat: true}, function (err, name) { | ||
console.log('running...') | ||
datDns.resolveName('beakerbrowser.com', {noWellknownDat: true, ignoreCache: true}, function (err, name) { | ||
console.log('res', err, name) | ||
t.error(err) | ||
@@ -140,0 +142,0 @@ t.ok(/[0-9a-f]{64}/.test(name)) |
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
21421
582