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

Function _normalize_header_key

httpx/_models.py:67–71  ·  httpx/_models.py::_normalize_header_key

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 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
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