diff options
| -rw-r--r-- | api-guide/status-codes.html | 19 | ||||
| -rw-r--r-- | topics/credits.html | 1 | ||||
| -rw-r--r-- | topics/release-notes.html | 5 |
3 files changed, 24 insertions, 1 deletions
diff --git a/api-guide/status-codes.html b/api-guide/status-codes.html index 906b2f9e..6c6a6ff9 100644 --- a/api-guide/status-codes.html +++ b/api-guide/status-codes.html @@ -174,6 +174,7 @@ <li><a href="#redirection---3xx">Redirection - 3xx</a></li> <li><a href="#client-error---4xx">Client Error - 4xx</a></li> <li><a href="#server-error---5xx">Server Error - 5xx</a></li> +<li><a href="#helper-functions">Helper functions</a></li> <div> <hr> @@ -220,6 +221,16 @@ def empty_view(self): return Response(content, status=status.HTTP_404_NOT_FOUND) </code></pre> <p>The full set of HTTP status codes included in the <code>status</code> module is listed below.</p> +<p>The module also includes a set of helper functions for testing if a status code is in a given range.</p> +<pre class="prettyprint lang-py"><code>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)) +</code></pre> <p>For more information on proper usage of HTTP status codes see <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">RFC 2616</a> and <a href="http://tools.ietf.org/html/rfc6585">RFC 6585</a>.</p> <h2 id="informational-1xx">Informational - 1xx</h2> @@ -282,6 +293,14 @@ HTTP_504_GATEWAY_TIMEOUT HTTP_505_HTTP_VERSION_NOT_SUPPORTED HTTP_511_NETWORK_AUTHENTICATION_REQUIRED </code></pre> +<h2 id="helper-functions">Helper functions</h2> +<p>The following helper functions are available for identifying the category of the response code.</p> +<pre class="prettyprint lang-py"><code>is_informational() # 1xx +is_success() # 2xx +is_redirect() # 3xx +is_client_error() # 4xx +is_server_error() # 5xx +</code></pre> </div><!--/span--> </div><!--/row--> </div><!--/.fluid-container--> diff --git a/topics/credits.html b/topics/credits.html index 1991f1e2..f22ce502 100644 --- a/topics/credits.html +++ b/topics/credits.html @@ -383,6 +383,7 @@ <li>Rob Hudson - <a href="https://github.com/robhudson">robhudson</a></li> <li>Alex Good - <a href="https://github.com/alexjg">alexjg</a></li> <li>Ian Foote - <a href="https://github.com/ian-foote">ian-foote</a></li> +<li>Chuck Harmston - <a href="https://github.com/chuckharmston">chuckharmston</a></li> </ul> <p>Many thanks to everyone who's contributed to the project.</p> <h2 id="additional-thanks">Additional thanks</h2> diff --git a/topics/release-notes.html b/topics/release-notes.html index 6c205ab2..74d4ba18 100644 --- a/topics/release-notes.html +++ b/topics/release-notes.html @@ -244,10 +244,13 @@ </code></pre> <hr /> <h2 id="23x-series">2.3.x series</h2> -<h3 id="master">Master</h3> +<h3 id="2310">2.3.10</h3> +<p><strong>Date</strong>: 6th December 2013</p> <ul> <li>Add in choices information for ChoiceFields in response to <code>OPTIONS</code> requests.</li> <li>Added <code>pre_delete()</code> and <code>post_delete()</code> method hooks.</li> +<li>Added status code category helper functions.</li> +<li>Bugfix: Partial updates which erronously set a related field to <code>None</code> now correctly fail validation instead of raising an exception.</li> <li>Bugfix: Responses without any content no longer include an HTTP <code>'Content-Type'</code> header.</li> <li>Bugfix: Correctly handle validation errors in PUT-as-create case, responding with 400.</li> </ul> |
