MCPcopy Create free account
hub / github.com/vercel/vercel / format_headers

Function format_headers

python/vercel-runtime/src/vercel_runtime/vc_init.py:517–530  ·  view source on GitHub ↗
(
    headers: Any,
    *,
    decode: bool = False,
)

Source from the content-addressed store, hash-verified

515
516
517def 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
533class ASGIMiddleware:

Callers 2

vc_handlerFunction · 0.85
on_requestMethod · 0.85

Calls 3

decodeMethod · 0.80
appendMethod · 0.80
itemsMethod · 0.45

Tested by

no test coverage detected