#36209: Add HttpResponse subclasses for No Content and Created
-------------------------------------+-------------------------------------
Reporter: Michiel Beijen | Type: New
| feature
Status: new | Component: HTTP
| handling
Version: dev | Severity: Normal
Keywords: HttpResponse REST | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Django has HttpResponse subclasses for many status codes. Although you can
use the generic HttpResponse and provide it with a status code, the
subclasses provide for more readable code: it's more clear to write
HttpResponseRedirect() or HttpResponsePermanentRedirect() than to use
HttpResponse with a 301 or 302 status code, because that requires you to
'know' which status code is which.
However for the RESTful HTTP response codes **201 Created** and **204 No
Content** there are no HttpResponse subclasses. It would be helpful to
people writing RESTful HTTP APIs to have HttpResponse subclasses for these
codes.
This patch adds **HttpResponseCreated** and **HttpResponseNoContent**
subclasses. I've targeted Django 6 because 5.2 is closed for new features.
--
Ticket URL: <
https://code.djangoproject.com/ticket/36209>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.