diff --git a/src/shared/hosts.js b/src/shared/hosts.js index 90624cc..d88e8d8 100644 --- a/src/shared/hosts.js +++ b/src/shared/hosts.js @@ -11,16 +11,5 @@ const url = require("./url"); * A matching host definition, or undefined if none are found. */ exports.matchHostDef = (host, hostDefs) => { - const pHostUrl = url.parse(host); - - if (pHostUrl && hostDefs) { - return hostDefs.find((hostDef) => - hostDef.urls.some((hostDefUrl) => { - const pHostDefUrl = url.parse(hostDefUrl); - return pHostDefUrl.hostname === pHostUrl.hostname; - }) - ); - } else { - return undefined; - } + return hostDefs?.find((hostDef) => url.findMatch(hostDef.urls, host)); };