diff options
| author | Tom Christie | 2013-12-06 22:13:50 +0000 |
|---|---|---|
| committer | Tom Christie | 2013-12-06 22:13:50 +0000 |
| commit | 910de38a9c8cd03243e738c8f4adcbade8a4d7d6 (patch) | |
| tree | 13c557324aae8b8738a98224d7ab3eef7aa11eef /docs | |
| parent | 85d9eb0f7ed3ef66a25a443b34ead914a506462c (diff) | |
| download | django-rest-framework-910de38a9c8cd03243e738c8f4adcbade8a4d7d6.tar.bz2 | |
Version 2.3.102.3.10
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/api-guide/status-codes.md | 21 | ||||
| -rw-r--r-- | docs/topics/release-notes.md | 5 |
2 files changed, 25 insertions, 1 deletions
diff --git a/docs/api-guide/status-codes.md b/docs/api-guide/status-codes.md index 409f659b..64c46434 100644 --- a/docs/api-guide/status-codes.md +++ b/docs/api-guide/status-codes.md @@ -17,6 +17,18 @@ Using bare status codes in your responses isn't recommended. REST framework inc The full set of HTTP status codes included in the `status` module is listed below. +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.test import APITestCase + + class ExampleTestCase(APITestCase): + def test_url_root(self): + url = reverse('index') + response = self.client.get(url) + self.assertTrue(status.is_success(response.status_code)) + + For more information on proper usage of HTTP status codes see [RFC 2616][rfc2616] and [RFC 6585][rfc6585]. @@ -90,6 +102,15 @@ Response status codes beginning with the digit "5" indicate cases in which the s HTTP_505_HTTP_VERSION_NOT_SUPPORTED HTTP_511_NETWORK_AUTHENTICATION_REQUIRED +## Helper functions + +The following helper functions are available for identifying the category of the response code. + + is_informational() # 1xx + is_success() # 2xx + is_redirect() # 3xx + is_client_error() # 4xx + is_server_error() # 5xx [rfc2324]: http://www.ietf.org/rfc/rfc2324.txt [rfc2616]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index 2df2cf93..b080ad43 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -40,10 +40,13 @@ You can determine your currently installed version using `pip freeze`: ## 2.3.x series -### Master +### 2.3.10 + +**Date**: 6th December 2013 * Add in choices information for ChoiceFields in response to `OPTIONS` requests. * Added `pre_delete()` and `post_delete()` method hooks. +* Added status code category helper functions. * Bugfix: Partial updates which erronously set a related field to `None` now correctly fail validation instead of raising an exception. * Bugfix: Responses without any content no longer include an HTTP `'Content-Type'` header. * Bugfix: Correctly handle validation errors in PUT-as-create case, responding with 400. |
