MCPcopy
hub / github.com/urllib3/urllib3 / putheader

Method putheader

src/urllib3/connection.py:410–420  ·  view source on GitHub ↗
(self, header: str, *values: str)

Source from the content-addressed store, hash-verified

408 )
409
410 def putheader(self, header: str, *values: str) -> None: # type: ignore[override]
411 """"""
412 if not any(isinstance(v, str) and v == SKIP_HEADER for v in values):
413 super().putheader(header, *values)
414 elif to_str(header.lower()) not in SKIPPABLE_HEADERS:
415 skippable_headers = "', '".join(
416 [str.title(header) for header in sorted(SKIPPABLE_HEADERS)]
417 )
418 raise ValueError(
419 f"urllib3.util.SKIP_HEADER only supports '{skippable_headers}'"
420 )
421
422 # `request` method's signature intentionally violates LSP.
423 # urllib3's API is different from `http.client.HTTPConnection` and the subclassing is only incidental.

Callers 1

requestMethod · 0.95

Calls 1

to_strFunction · 0.85

Tested by

no test coverage detected