Skip to content

Commit da2ff1b

Browse files
pantuzatomchristie
authored andcommitted
Adding support for RFC 4918 status codes (#4291)
* Added HTTP status codes from RFC 4918 * Updated documentation about status codes * Added reference to RFC 4918
1 parent 3ca0b15 commit da2ff1b

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

docs/api-guide/status-codes.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ This class of status code indicates that the client's request was successfully r
5050
HTTP_204_NO_CONTENT
5151
HTTP_205_RESET_CONTENT
5252
HTTP_206_PARTIAL_CONTENT
53+
HTTP_207_MULTI_STATUS
5354

5455
## Redirection - 3xx
5556

@@ -86,6 +87,9 @@ The 4xx class of status code is intended for cases in which the client seems to
8687
HTTP_415_UNSUPPORTED_MEDIA_TYPE
8788
HTTP_416_REQUESTED_RANGE_NOT_SATISFIABLE
8889
HTTP_417_EXPECTATION_FAILED
90+
HTTP_422_UNPROCESSABLE_ENTITY
91+
HTTP_423_LOCKED
92+
HTTP_424_FAILED_DEPENDENCY
8993
HTTP_428_PRECONDITION_REQUIRED
9094
HTTP_429_TOO_MANY_REQUESTS
9195
HTTP_431_REQUEST_HEADER_FIELDS_TOO_LARGE
@@ -101,6 +105,7 @@ Response status codes beginning with the digit "5" indicate cases in which the s
101105
HTTP_503_SERVICE_UNAVAILABLE
102106
HTTP_504_GATEWAY_TIMEOUT
103107
HTTP_505_HTTP_VERSION_NOT_SUPPORTED
108+
HTTP_507_INSUFFICIENT_STORAGE
104109
HTTP_511_NETWORK_AUTHENTICATION_REQUIRED
105110

106111
## Helper functions

rest_framework/status.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
See RFC 2616 - http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
55
And RFC 6585 - http://tools.ietf.org/html/rfc6585
6+
And RFC 4918 - https://tools.ietf.org/html/rfc4918
67
"""
78
from __future__ import unicode_literals
89

@@ -36,6 +37,7 @@ def is_server_error(code):
3637
HTTP_204_NO_CONTENT = 204
3738
HTTP_205_RESET_CONTENT = 205
3839
HTTP_206_PARTIAL_CONTENT = 206
40+
HTTP_207_MULTI_STATUS = 207
3941
HTTP_300_MULTIPLE_CHOICES = 300
4042
HTTP_301_MOVED_PERMANENTLY = 301
4143
HTTP_302_FOUND = 302
@@ -62,6 +64,9 @@ def is_server_error(code):
6264
HTTP_415_UNSUPPORTED_MEDIA_TYPE = 415
6365
HTTP_416_REQUESTED_RANGE_NOT_SATISFIABLE = 416
6466
HTTP_417_EXPECTATION_FAILED = 417
67+
HTTP_422_UNPROCESSABLE_ENTITY = 422
68+
HTTP_423_LOCKED = 423
69+
HTTP_424_FAILED_DEPENDENCY = 424
6570
HTTP_428_PRECONDITION_REQUIRED = 428
6671
HTTP_429_TOO_MANY_REQUESTS = 429
6772
HTTP_431_REQUEST_HEADER_FIELDS_TOO_LARGE = 431
@@ -72,4 +77,5 @@ def is_server_error(code):
7277
HTTP_503_SERVICE_UNAVAILABLE = 503
7378
HTTP_504_GATEWAY_TIMEOUT = 504
7479
HTTP_505_HTTP_VERSION_NOT_SUPPORTED = 505
80+
HTTP_507_INSUFFICIENT_STORAGE = 507
7581
HTTP_511_NETWORK_AUTHENTICATION_REQUIRED = 511

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy