Skip to content

Commit d668f41

Browse files
committed
Allow localhost URLs for testing
1 parent b4ff197 commit d668f41

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/utils/parse-endpoint.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import isUrl from "validator/es/lib/isURL"
33
export const parseEndpoint = (input: string): string => {
44
let url: URL
55

6-
if (isUrl(input, { require_protocol: true, protocols: ["https"] })) {
6+
if (isUrl(input, { require_protocol: true, protocols: ["https", "http"], host_whitelist: ["localhost"] })) {
77
url = new URL(input)
88
} else if (isUrl(input, { require_protocol: false, protocols: ["https"] })) {
9-
url = new URL(`https://${input}`)
9+
url = new URL(`https://${input}`);
1010
} else {
1111
throw new TypeError(`Invalid URL: ${input}`)
1212
}

0 commit comments

Comments
 (0)