(
headers: Any,
*,
decode: bool = False,
)
| 515 | |
| 516 | |
| 517 | def format_headers( |
| 518 | headers: Any, |
| 519 | *, |
| 520 | decode: bool = False, |
| 521 | ) -> dict[str, list[str]]: |
| 522 | key_to_list: dict[str, list[str]] = {} |
| 523 | for key, value in headers.items(): |
| 524 | if decode and hasattr(key, "decode") and hasattr(value, "decode"): |
| 525 | key = key.decode() # noqa: PLW2901 |
| 526 | value = value.decode() # noqa: PLW2901 |
| 527 | if key not in key_to_list: |
| 528 | key_to_list[key] = [] |
| 529 | key_to_list[key].append(value) |
| 530 | return key_to_list |
| 531 | |
| 532 | |
| 533 | class ASGIMiddleware: |
no test coverage detected