Changes between Initial Version and Version 3 of Ticket #24598
- Timestamp:
- Apr 8, 2015, 7:50:49 AM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #24598 – Description
initial v3 1 By default when a content_type is not passed to HttpResponse it will create one from settings.DEFAULT_CONTENT_TYPE, and attach the encoding.1 By default when a content_type is not passed to `HttpResponse` it will create one from `settings.DEFAULT_CONTENT_TYPE`, and attach the encoding. 2 2 3 3 So, when unspecified, the header will appear as: … … 7 7 }}} 8 8 9 However, if you specify the content_type, this action is notaken.9 However, if you specify the `content_type`, this action is not taken. 10 10 11 That's understandable in a "consenting adults" context, however the JsonResponse sets content_type using kwargs.setdefault, thus forcing the loss of encoding annotation in all responses.11 That's understandable in a "consenting adults" context, however the `JsonResponse` sets `content_type` using `kwargs.setdefault`, thus forcing the loss of encoding annotation in all responses. 12 12 13 I propose instead that HttpResponseBase check for a ``default_content_type`` property to override settings.DEFAULT_CONTENT_TYPE, thus:13 I propose instead that `HttpResponseBase` check for a `default_content_type` property to override `settings.DEFAULT_CONTENT_TYPE`, thus: 14 14 15 15 16 16 {{{ 17 #!diff 17 18 diff --git a/django/http/response.py b/django/http/response.py 18 19 index c8d6930..40186b5 100644