Enhance http.HTTPStatus
with is_*
properties that indicate the HTTP status category
#95149
Labels
type-feature
A feature request or enhancement
Feature or enhancement
Add five properties to
http.HTTPStatus
that indicate the category the status belongs to:Pitch
Programs that deal with HTTP requests usually need to deal with the various status codes. Oftentimes, knowing the broad category is sufficient to make quick decisions. For example, a client needs to handle responses differently depending on the status code. Assuming
status
is anHTTPStatus
, instead of writing:One could more elegantly write:
Enums are safer, more readable and more expressive than magic numbers. I think these small additions would only strengthen
HTTPStatus
.Let me know if this interests you, and I can open a PR.
The text was updated successfully, but these errors were encountered: