MCPcopy
hub / github.com/urllib3/urllib3 / _prepare_for_method_change

Method _prepare_for_method_change

src/urllib3/_collections.py:399–415  ·  view source on GitHub ↗

Remove content-specific header fields before changing the request method to GET or HEAD according to RFC 9110, Section 15.4.

(self)

Source from the content-addressed store, hash-verified

397 return vals[1:]
398
399 def _prepare_for_method_change(self) -> Self:
400 """
401 Remove content-specific header fields before changing the request
402 method to GET or HEAD according to RFC 9110, Section 15.4.
403 """
404 content_specific_headers = [
405 "Content-Encoding",
406 "Content-Language",
407 "Content-Location",
408 "Content-Type",
409 "Content-Length",
410 "Digest",
411 "Last-Modified",
412 ]
413 for header in content_specific_headers:
414 self.discard(header)
415 return self
416
417 # Backwards compatibility for httplib
418 getheaders = getlist

Callers 2

urlopenMethod · 0.80
urlopenMethod · 0.80

Calls 1

discardMethod · 0.95

Tested by

no test coverage detected