Skip to content

Commit

Permalink
Add missing HTTP status codes (#1920)
Browse files Browse the repository at this point in the history
* Add HTTP status code 422 (Unprocessable Entity)

* Add HTTP status code 424 (Failed Dependency)

* Add HTTP status code 507 (Insufficient Storage)

* Update contributors

* Update CHANGES.rst
  • Loading branch information
0xd669 authored and asvetlov committed May 26, 2017
1 parent f64de97 commit ec9dd3c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ Changes
- Use Forwarded, X-Forwarded-Scheme and X-Forwarded-Host for better scheme and
host resolution. #1134

- Extend list of web exceptions, add HTTPUnprocessableEntity,
HTTPFailedDependency, HTTPInsufficientStorage status codes #1920


2.0.7 (2017-04-12)
------------------
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ Stanislas Plum
Stanislav Prokop
Stephen Granade
Steven Seguin
Sunghyun Hwang
Sviatoslav Bulbakha
Taha Jahangir
Taras Voinarovskyi
Expand Down
15 changes: 15 additions & 0 deletions aiohttp/web_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
'HTTPRequestRangeNotSatisfiable',
'HTTPExpectationFailed',
'HTTPMisdirectedRequest',
'HTTPUnprocessableEntity',
'HTTPFailedDependency',
'HTTPUpgradeRequired',
'HTTPPreconditionRequired',
'HTTPTooManyRequests',
Expand All @@ -54,6 +56,7 @@
'HTTPGatewayTimeout',
'HTTPVersionNotSupported',
'HTTPVariantAlsoNegotiates',
'HTTPInsufficientStorage',
'HTTPNotExtended',
'HTTPNetworkAuthenticationRequired',
)
Expand Down Expand Up @@ -271,6 +274,14 @@ class HTTPMisdirectedRequest(HTTPClientError):
status_code = 421


class HTTPUnprocessableEntity(HTTPClientError):
status_code = 422


class HTTPFailedDependency(HTTPClientError):
status_code = 424


class HTTPUpgradeRequired(HTTPClientError):
status_code = 426

Expand Down Expand Up @@ -342,6 +353,10 @@ class HTTPVariantAlsoNegotiates(HTTPServerError):
status_code = 506


class HTTPInsufficientStorage(HTTPServerError):
status_code = 507


class HTTPNotExtended(HTTPServerError):
status_code = 510

Expand Down
3 changes: 3 additions & 0 deletions docs/web.rst
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,8 @@ HTTP Exception hierarchy chart::
* 416 - HTTPRequestRangeNotSatisfiable
* 417 - HTTPExpectationFailed
* 421 - HTTPMisdirectedRequest
* 422 - HTTPUnprocessableEntity
* 424 - HTTPFailedDependency
* 426 - HTTPUpgradeRequired
* 428 - HTTPPreconditionRequired
* 429 - HTTPTooManyRequests
Expand All @@ -800,6 +802,7 @@ HTTP Exception hierarchy chart::
* 504 - HTTPGatewayTimeout
* 505 - HTTPVersionNotSupported
* 506 - HTTPVariantAlsoNegotiates
* 507 - HTTPInsufficientStorage
* 510 - HTTPNotExtended
* 511 - HTTPNetworkAuthenticationRequired

Expand Down

0 comments on commit ec9dd3c

Please sign in to comment.