Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.

Removing isValidHostname check in flavor of #55 #56

Merged
merged 2 commits into from
Sep 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/__tests__/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ describe("sslChecker", () => {
}
});

it("Should return 'Invalid host' when no host provided", async () => {
try {
await sslChecker();
} catch (e) {
expect(e).toEqual(new Error("Invalid host"));
}
});

it("Should return 'Invalid port' when no port provided", async () => {
try {
await sslChecker(validSslHost, { port: "port" });
Expand Down
9 changes: 0 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,6 @@ const sslChecker = (
}
): Promise<IResolvedValues> =>
new Promise((resolve, reject) => {
const isValidHostName =
host &&
/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/.test(
host
);

if (!isValidHostName) {
reject(new Error("Invalid host"));
}

if (!checkPort(options.port)) {
reject(Error("Invalid port"));
Expand Down