From 19aac80ce7402555e25fd2c80bc8ef8d6b06d0fb Mon Sep 17 00:00:00 2001 From: Sam Therapy Date: Sun, 19 Jun 2022 16:03:54 +0200 Subject: [PATCH] Allow query to not be case sensitive Signed-off-by: Sam Therapy --- args.ts | 3 ++- lib/utils.ts | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/args.ts b/args.ts index 2f30085..608612e 100644 --- a/args.ts +++ b/args.ts @@ -1,3 +1,4 @@ + import { Args } from "./deps.ts"; import { isRecordType, ServerOptions } from "./lib/utils.ts"; /** @@ -36,7 +37,7 @@ export function parseArgs(args: Args): arguments { } if (isRecordType(arg)) { - parsed.type = arg; + parsed.type = arg.toUpperCase() as Deno.RecordType; return; } diff --git a/lib/utils.ts b/lib/utils.ts index 8709d54..0ce5b53 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -24,9 +24,9 @@ export type ServerOptions = { }; export function isRecordType(type: string): type is Deno.RecordType { - return type === "A" || type === "AAAA" || type === "CNAME" || type === "MX" || - type === "NS" || type === "PTR" || type === "SOA" || type === "TXT" || - type === "NAPTR" || type === "SRV"; + return type.toUpperCase() === "A" || type.toUpperCase() === "AAAA" || type.toUpperCase() === "CNAME" || type.toUpperCase() === "MX" || + type.toUpperCase() === "NS" || type.toUpperCase() === "PTR" || type.toUpperCase() === "SOA" || type.toUpperCase() === "TXT" || + type.toUpperCase() === "NAPTR" || type.toUpperCase() === "SRV" || type.toUpperCase() === "CAA"; } /**