From a49bb37da6151ecdec164ebaedb133541de41b3c Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Sat, 6 Apr 2024 05:46:44 -0700 Subject: [PATCH] fix: cloudflare dns only supports string type (#7) --- src/resolvers/dns-json-over-https.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/resolvers/dns-json-over-https.ts b/src/resolvers/dns-json-over-https.ts index e4a497f..fd05ff0 100644 --- a/src/resolvers/dns-json-over-https.ts +++ b/src/resolvers/dns-json-over-https.ts @@ -2,10 +2,10 @@ import PQueue from 'p-queue' import { CustomProgressEvent } from 'progress-events' +import { RecordType, type DNSResponse } from '../index.js' import { getTypes } from '../utils/get-types.js' import { toDNSResponse } from '../utils/to-dns-response.js' import type { DNSResolver } from './index.js' -import type { DNSResponse } from '../index.js' /** * Browsers limit concurrent connections per host (~6), we don't want to exhaust @@ -43,7 +43,8 @@ export function dnsJsonOverHttps (url: string, init: DNSJSONOverHTTPSOptions = { searchParams.set('name', fqdn) getTypes(options.types).forEach(type => { - searchParams.append('type', type.toString()) + // We pass record type as a string to the server because cloudflare DNS bug. see https://github.com/ipfs/helia/issues/474 + searchParams.append('type', RecordType[type]) }) options.onProgress?.(new CustomProgressEvent('dns:query', { detail: fqdn }))