mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-06-30 18:33:21 +03:00
Update status code docs (#6732)
This commit is contained in:
parent
6a8575b042
commit
9ac9c1b2ea
|
@ -20,13 +20,13 @@ The full set of HTTP status codes included in the `status` module is listed belo
|
||||||
The module also includes a set of helper functions for testing if a status code is in a given range.
|
The module also includes a set of helper functions for testing if a status code is in a given range.
|
||||||
|
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from rest_framework.test import APITestCase
|
from rest_framework.test import APITestCase
|
||||||
|
|
||||||
class ExampleTestCase(APITestCase):
|
class ExampleTestCase(APITestCase):
|
||||||
def test_url_root(self):
|
def test_url_root(self):
|
||||||
url = reverse('index')
|
url = reverse('index')
|
||||||
response = self.client.get(url)
|
response = self.client.get(url)
|
||||||
self.assertTrue(status.is_success(response.status_code))
|
self.assertTrue(status.is_success(response.status_code))
|
||||||
|
|
||||||
|
|
||||||
For more information on proper usage of HTTP status codes see [RFC 2616][rfc2616]
|
For more information on proper usage of HTTP status codes see [RFC 2616][rfc2616]
|
||||||
|
@ -51,6 +51,8 @@ This class of status code indicates that the client's request was successfully r
|
||||||
HTTP_205_RESET_CONTENT
|
HTTP_205_RESET_CONTENT
|
||||||
HTTP_206_PARTIAL_CONTENT
|
HTTP_206_PARTIAL_CONTENT
|
||||||
HTTP_207_MULTI_STATUS
|
HTTP_207_MULTI_STATUS
|
||||||
|
HTTP_208_ALREADY_REPORTED
|
||||||
|
HTTP_226_IM_USED
|
||||||
|
|
||||||
## Redirection - 3xx
|
## Redirection - 3xx
|
||||||
|
|
||||||
|
@ -64,6 +66,7 @@ This class of status code indicates that further action needs to be taken by the
|
||||||
HTTP_305_USE_PROXY
|
HTTP_305_USE_PROXY
|
||||||
HTTP_306_RESERVED
|
HTTP_306_RESERVED
|
||||||
HTTP_307_TEMPORARY_REDIRECT
|
HTTP_307_TEMPORARY_REDIRECT
|
||||||
|
HTTP_308_PERMANENT_REDIRECT
|
||||||
|
|
||||||
## Client Error - 4xx
|
## Client Error - 4xx
|
||||||
|
|
||||||
|
@ -90,6 +93,7 @@ The 4xx class of status code is intended for cases in which the client seems to
|
||||||
HTTP_422_UNPROCESSABLE_ENTITY
|
HTTP_422_UNPROCESSABLE_ENTITY
|
||||||
HTTP_423_LOCKED
|
HTTP_423_LOCKED
|
||||||
HTTP_424_FAILED_DEPENDENCY
|
HTTP_424_FAILED_DEPENDENCY
|
||||||
|
HTTP_426_UPGRADE_REQUIRED
|
||||||
HTTP_428_PRECONDITION_REQUIRED
|
HTTP_428_PRECONDITION_REQUIRED
|
||||||
HTTP_429_TOO_MANY_REQUESTS
|
HTTP_429_TOO_MANY_REQUESTS
|
||||||
HTTP_431_REQUEST_HEADER_FIELDS_TOO_LARGE
|
HTTP_431_REQUEST_HEADER_FIELDS_TOO_LARGE
|
||||||
|
@ -105,7 +109,11 @@ Response status codes beginning with the digit "5" indicate cases in which the s
|
||||||
HTTP_503_SERVICE_UNAVAILABLE
|
HTTP_503_SERVICE_UNAVAILABLE
|
||||||
HTTP_504_GATEWAY_TIMEOUT
|
HTTP_504_GATEWAY_TIMEOUT
|
||||||
HTTP_505_HTTP_VERSION_NOT_SUPPORTED
|
HTTP_505_HTTP_VERSION_NOT_SUPPORTED
|
||||||
|
HTTP_506_VARIANT_ALSO_NEGOTIATES
|
||||||
HTTP_507_INSUFFICIENT_STORAGE
|
HTTP_507_INSUFFICIENT_STORAGE
|
||||||
|
HTTP_508_LOOP_DETECTED
|
||||||
|
HTTP_509_BANDWIDTH_LIMIT_EXCEEDED
|
||||||
|
HTTP_510_NOT_EXTENDED
|
||||||
HTTP_511_NETWORK_AUTHENTICATION_REQUIRED
|
HTTP_511_NETWORK_AUTHENTICATION_REQUIRED
|
||||||
|
|
||||||
## Helper functions
|
## Helper functions
|
||||||
|
|
Loading…
Reference in New Issue
Block a user