INNER CODE UNIT · Python
inner
stephenhillier/starlette_exporter · starlette_exporter/labels.py:47
def inner(r: Request):
v = r.headers.get(key, "")
# if allowed_values was supplied, return a blank string if
# the value of the header does match any of the values.
if allowed_values is not None and v not in allowed_values:
return ""
return v
return inner
def from_response_header(
key: str, allowed_values: Optional[Iterable] = None, default: str = ""
):
"""returns a callable class that retrieves a header value from response headers.
starlette_exporter will automatically populate this label value when response headers