mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-14 13:46:59 +03:00
Version 2.3.10
This commit is contained in:
parent
5e7547cd3f
commit
3dd0a78317
|
@ -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>
|
||||
|
@ -281,6 +292,14 @@ HTTP_503_SERVICE_UNAVAILABLE
|
|||
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-->
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue
Block a user