Skip to content

Commit 83dd841

Browse files
authored
Allow subdomains and localhost in new domain validator (#84)
* fix subdomain * add localhost
1 parent 1ed164f commit 83dd841

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ type IReturnData<O extends Options = {}> = (IDomainData) & (IReturnCa<O>) & (IRe
6969
export async function certificateFor<O extends Options>(requestedDomains: string | string[], options: O = {} as O): Promise<IReturnData<O>> {
7070
const domains = Array.isArray(requestedDomains) ? requestedDomains : [requestedDomains];
7171
domains.forEach((domain) => {
72-
if (!isValidDomain(domain, { subdomain: false, wildcard: false, allowUnicode: true, topLevel: false })) {
72+
if (domain !== "localhost" && !isValidDomain(domain, { subdomain: true, wildcard: false, allowUnicode: true, topLevel: false })) {
7373
throw new Error(`"${domain}" is not a valid domain name.`);
7474
}
7575
});

0 commit comments

Comments
 (0)