MCPcopy
hub / github.com/encode/httpx / _normalize_header_key

Function _normalize_header_key

httpx/_models.py:67–71  ·  view source on GitHub ↗

Coerce str/bytes into a strictly byte-wise HTTP header key.

(key: str | bytes, encoding: str | None = None)

Source from the content-addressed store, hash-verified

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

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected