Enhance http.HTTPStatus with is_* properties that indicate the HTTP status category
#95149
Labels
type-feature
A feature request or enhancement
alexei commentedJul 22, 2022
•
edited
Feature or enhancement
Add five properties to
http.HTTPStatusthat 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
statusis 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: