MCPcopy
hub / github.com/urllib3/urllib3 / is_response_to_head

Function is_response_to_head

src/urllib3/util/response.py:91–101  ·  view source on GitHub ↗

Checks whether the request of a response has been a HEAD-request. :param http.client.HTTPResponse response: Response to check if the originating request used 'HEAD' as a method.

(response: httplib.HTTPResponse)

Source from the content-addressed store, hash-verified

89
90
91def is_response_to_head(response: httplib.HTTPResponse) -> bool:
92 """
93 Checks whether the request of a response has been a HEAD-request.
94
95 :param http.client.HTTPResponse response:
96 Response to check if the originating request
97 used 'HEAD' as a method.
98 """
99 # FIXME: Can we do this somehow without accessing private httplib _method?
100 method_str = response._method # type: str # type: ignore[attr-defined]
101 return method_str.upper() == "HEAD"

Callers 1

read_chunkedMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected