From 56b80f7e3dbc2501b9d4e506b82ee3a3d955e5f5 Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 24 Jun 2020 23:49:40 +0200 Subject: [PATCH 1/2] Removing isValidHostname check in flavor of #55 The check does not work properly and node has excellent error handling itself. --- src/index.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/index.ts b/src/index.ts index 9d2742e..c4afffb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -33,15 +33,6 @@ const sslChecker = ( } ): Promise => 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")); From 70791a19ed58ff8bdb37af164186b226c53a39aa Mon Sep 17 00:00:00 2001 From: Tom Sacher Date: Wed, 24 Jun 2020 23:59:59 +0200 Subject: [PATCH 2/2] fix: update tests --- src/__tests__/index.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/__tests__/index.ts b/src/__tests__/index.ts index 7a2587d..3cebd40 100644 --- a/src/__tests__/index.ts +++ b/src/__tests__/index.ts @@ -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" });