Coerce str/bytes into a strictly byte-wise HTTP header key.
(key: str | bytes, encoding: str | None = None)
| 65 | |
| 66 | |
| 67 | def _normalize_header_key(key: str | bytes, encoding: str | None = None) -> bytes: |
| 68 | class="st">""" |
| 69 | Coerce str/bytes into a strictly byte-wise HTTP header key. |
| 70 | class="st">""" |
| 71 | return key if isinstance(key, bytes) else key.encode(encoding or class="st">"ascii") |
| 72 | |
| 73 | |
| 74 | def _normalize_header_value(value: str | bytes, encoding: str | None = None) -> bytes: |