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)
| 89 | |
| 90 | |
| 91 | def 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" |