MCPcopy Create free account
hub / github.com/angular/angular / isHostAllowed

Function isHostAllowed

packages/platform-server/src/utils.ts:457–474  ·  view source on GitHub ↗
(hostname: string, allowedHosts: ReadonlySet<string>)

Source from the content-addressed store, hash-verified

455 * @private
456 */
457export function isHostAllowed(hostname: string, allowedHosts: ReadonlySet<string>): boolean {
458 if (allowedHosts.has('*') || allowedHosts.has(hostname)) {
459 return true;
460 }
461
462 for (const allowedHost of allowedHosts) {
463 if (!allowedHost.startsWith('*.')) {
464 continue;
465 }
466
467 const domain = allowedHost.slice(1);
468 if (hostname.endsWith(domain)) {
469 return true;
470 }
471 }
472
473 return false;
474}

Callers 2

utils_spec.tsFile · 0.90
validateAllowedHostsFunction · 0.85

Calls 2

hasMethod · 0.65
sliceMethod · 0.65

Tested by

no test coverage detected