From bd426fa504acfd178742533e213ef79788756ac3 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Fri, 23 Apr 2021 21:54:57 -0400 Subject: [PATCH] Support only domain in url --- types/url.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/url.js b/types/url.js index c9f0a314..0a593ea9 100644 --- a/types/url.js +++ b/types/url.js @@ -8,10 +8,11 @@ module.exports = class UrlType extends ArgumentType { } validate(value) { - return Boolean(validURL.isWebUri(value)); + return Boolean(validURL.isWebUri(value) || validURL.isWebUri(`http://${value}`)); } parse(value) { + if (!validURL.isWebUri(value)) return new URL(`http://${value}`); return new URL(value); } };