Return True when the response MUST NOT have a body (RFC 9110). Applies to HEAD requests and to status codes that semantically carry no body: 1xx informational, 204 No Content, 304 Not Modified.
(method, status)
| 1330 | |
| 1331 | @staticmethod |
| 1332 | def _response_omits_body(method, status): |
| 1333 | """Return True when the response MUST NOT have a body (RFC 9110). |
| 1334 | |
| 1335 | Applies to HEAD requests and to status codes that semantically carry no body: |
| 1336 | 1xx informational, 204 No Content, 304 Not Modified. |
| 1337 | """ |
| 1338 | return ( |
| 1339 | method == "HEAD" |
| 1340 | or status in (204, 304) |
| 1341 | or 100 <= status < 200 |
| 1342 | ) |
| 1343 | |
| 1344 | @staticmethod |
| 1345 | def _response_forbids_content_length(status): |