MCPcopy Index your code
hub / github.com/google/adk-python / _is_origin_allowed

Function _is_origin_allowed

src/google/adk/cli/api_server.py:127–139  ·  view source on GitHub ↗

Check whether the given origin matches the allowed origins.

(
    origin: str,
    allowed_literal_origins: list[str],
    allowed_origin_regex: Optional[re.Pattern[str]],
)

Source from the content-addressed store, hash-verified

125
126
127def _is_origin_allowed(
128 origin: str,
129 allowed_literal_origins: list[str],
130 allowed_origin_regex: Optional[re.Pattern[str]],
131) -> bool:
132 """Check whether the given origin matches the allowed origins."""
133 if "*" in allowed_literal_origins:
134 return True
135 if origin in allowed_literal_origins:
136 return True
137 if allowed_origin_regex is not None:
138 return allowed_origin_regex.fullmatch(origin) is not None
139 return False
140
141
142def _normalize_origin_scheme(scheme: str) -> str:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected