INNER CODE UNIT · Python
_storable_headers
redis/fastapi-redis-sdk · src/redis_fastapi/cache.py:400
def _storable_headers(
response_headers: list[tuple[bytes, bytes]],
) -> list[list[str]]:
"""Return the header fields to store, in the order they were received.
Pairs rather than a mapping: a response may carry several ``Link`` or
``Set-Cookie`` fields, and both their repetition and their order are part
of what it means.
Args:
response_headers: Raw ASGI response headers.
Returns:
``[name, value]`` pairs, lowercased names, JSON-serialisable.
"""
excluded = _excluded_from_storage(response_headers)
return [
[name.decode(HEADER_ENCODING).lower(), value.decode(HEADER_ENCODING)]