Skip to content

Commit

Permalink
Merge pull request #12 from cagov/multi-hosts-per-domain
Browse files Browse the repository at this point in the history
Fix host definition matching
  • Loading branch information
xjensen authored Nov 20, 2023
2 parents 5318a70 + fe57508 commit 06f55a5
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/shared/hosts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
};

0 comments on commit 06f55a5

Please sign in to comment.