MCPcopy
hub / github.com/psf/requests / prepare_headers

Method prepare_headers

src/requests/models.py:563–572  ·  view source on GitHub ↗

Prepares the given HTTP headers.

(self, headers: Mapping[str, str | bytes] | None)

Source from the content-addressed store, hash-verified

561 self.url = url
562
563 def prepare_headers(self, headers: Mapping[str, str | bytes] | None) -> None:
564 """Prepares the given HTTP headers."""
565
566 self.headers = CaseInsensitiveDict()
567 if headers:
568 for header in headers.items():
569 # Raise exception on invalid header value.
570 check_header_validity(header)
571 name, value = header
572 self.headers[to_native_string(name)] = value
573
574 def prepare_body(
575 self, data: _t.DataType, files: _t.FilesType, json: _t.JsonType = None

Callers 1

prepareMethod · 0.95

Calls 4

CaseInsensitiveDictClass · 0.85
check_header_validityFunction · 0.85
to_native_stringFunction · 0.85
itemsMethod · 0.45

Tested by

no test coverage detected