Closed SaltwaterC closed 9 years ago
Which documentation are you referring to? From what you're saying this seems more just like an API that isn't accurately documented, but everything works OK otherwise, correct?
I am referring to the README file where ResourceRecord is defined. This document states that for the TXT type, the answer of the query should be into the data property of the RR object, having a typeof string.
I made a some TXT records on one of my domains for testing purposes.
dig txt saltwaterc.eu
[...]
;; ANSWER SECTION:
saltwaterc.eu. 300 IN TXT "txt value 2"
saltwaterc.eu. 300 IN TXT "txt value 1"
[...]
node dns-native.js saltwaterc.eu TXT
[ { name: 'saltwaterc.eu',
type: 16,
class: 1,
ttl: 299,
data: [ 'txt value 1' ] },
{ name: 'saltwaterc.eu',
type: 16,
class: 1,
ttl: 299,
data: [ 'txt value 2' ] } ]
Besides, that array for data is useless since the answer follows the same rules as any other RR that has multiple values for the same domain aka it returns an array of RR objects.
According to RFC 1035:
TXT-DATA One or more <character-string>s.
Sounds like it needs to be an array, so closing.
Thanks, it makes sense now. Added a secondary string to a TXT record to check the behaviour. However, the README needs an update to reflect the fact that data for the TXT RR is an array
, not a string
.
dig txt saltwaterc.eu
[...]
;; ANSWER SECTION:
saltwaterc.eu. 299 IN TXT "txt value 2"
saltwaterc.eu. 299 IN TXT "txt value 1" "txt value 2"
[...]
node dns-native.js saltwaterc.eu TXT
[ { name: 'saltwaterc.eu',
type: 16,
class: 1,
ttl: 284,
data: [ 'txt value 2' ] },
{ name: 'saltwaterc.eu',
type: 16,
class: 1,
ttl: 284,
data: [ 'txt value 1', 'txt value 2' ] } ]
K, that can be done, I've changed the title to reflect that and have reopened the issue.
bump
just got bit by this myself
Thanks @coolaj86! Merged your PR.
The ResourceRecord from the documentation lists the data element of the answer to be a string for TXT queries. However, the answer contains an array of strings. This goes even against the records that use round robin (such as the A record) which contains an array of objects for each address. I made A and MX queries for comparison.
The dns-native.js script is the following:
Am I missing something for having predictable behaviour per documentation or this is an actual bug?