MCPcopy
hub / github.com/pallets/werkzeug / _parse_headers

Method _parse_headers

src/werkzeug/sansio/multipart.py:225–236  ·  view source on GitHub ↗
(self, data: bytes | bytearray)

Source from the content-addressed store, hash-verified

223 return event
224
225 def _parse_headers(self, data: bytes | bytearray) -> Headers:
226 headers: list[tuple[str, str]] = []
227 # Merge the continued headers into one line
228 data = HEADER_CONTINUATION_RE.sub(b" ", data)
229 # Now there is one header per line
230 for line in data.splitlines():
231 line = line.strip()
232
233 if line != b"":
234 name, _, value = line.decode().partition(":")
235 headers.append((name.strip(), value.strip()))
236 return Headers(headers)
237
238 def _parse_data(
239 self, data: bytes | bytearray, *, start: bool

Callers 1

next_eventMethod · 0.95

Calls 2

HeadersClass · 0.85
appendMethod · 0.80

Tested by

no test coverage detected