[Django] #31789: Add a cleaner interface for response headers

40 views
Skip to first unread message

Django

unread,
Jul 14, 2020, 8:34:27 AM7/14/20
to django-...@googlegroups.com
#31789: Add a cleaner interface for response headers
------------------------------------------------+------------------------
Reporter: Tom Carrick | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: HTTP handling | Version: 3.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
This proposal is to replace `HttpResponse._headers` with
`HttpResponse.headers` as a public interface using a variation of
`django.utils.datasctructures.CaseInsensitiveMapping`.

It also includes updating tests and documentation to use this, rather than
the old dict-like interface, i.e. `response.headers['Content-Type'] =
'application/json'` `response['Content-Type'] = 'application/json'`.

The dict-like interface won't be deprecated, but will become undocumented,
and tests added purely for backwards-compatibility.

[https://groups.google.com/u/2/g/django-developers/c/rlt1HhEaPaM Mailing
list]
[https://github.com/django/django/pull/13186 Draft PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/31789>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 14, 2020, 8:34:54 AM7/14/20
to django-...@googlegroups.com
#31789: Add a cleaner interface for response headers
-------------------------------------+-------------------------------------
Reporter: Tom Carrick | Owner: Tom
Type: | Carrick
Cleanup/optimization | Status: assigned

Component: HTTP handling | Version: 3.0
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tom Carrick):

* owner: nobody => Tom Carrick
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/31789#comment:1>

Django

unread,
Jul 14, 2020, 10:10:20 AM7/14/20
to django-...@googlegroups.com
#31789: Add a cleaner interface for response headers
-------------------------------------+-------------------------------------
Reporter: Tom Carrick | Owner: Tom
Type: | Carrick
Cleanup/optimization | Status: assigned
Component: HTTP handling | Version: 3.0
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tom Carrick):

* needs_docs: 0 => 1
* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/31789#comment:2>

Django

unread,
Jul 14, 2020, 12:16:21 PM7/14/20
to django-...@googlegroups.com
#31789: Add a cleaner interface for response headers
-------------------------------------+-------------------------------------
Reporter: Tom Carrick | Owner: Tom
Type: | Carrick
Cleanup/optimization | Status: assigned
Component: HTTP handling | Version: master
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tom Carrick):

* needs_docs: 1 => 0
* version: 3.0 => master
* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/31789#comment:3>

Django

unread,
Jul 14, 2020, 5:48:09 PM7/14/20
to django-...@googlegroups.com
#31789: Add a cleaner interface for response headers
-------------------------------------+-------------------------------------
Reporter: Tom Carrick | Owner: Tom
Type: | Carrick
Cleanup/optimization | Status: assigned
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Asif Saifuddin Auvi):

* stage: Unreviewed => Accepted


Comment:

I believe this should be accepted

--
Ticket URL: <https://code.djangoproject.com/ticket/31789#comment:4>

Django

unread,
Jul 15, 2020, 4:39:24 AM7/15/20
to django-...@googlegroups.com
#31789: Add a cleaner interface for response headers
-------------------------------------+-------------------------------------
Reporter: Tom Carrick | Owner: Tom
Type: | Carrick
Cleanup/optimization | Status: assigned
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Tom Carrick:

Old description:

> This proposal is to replace `HttpResponse._headers` with
> `HttpResponse.headers` as a public interface using a variation of
> `django.utils.datasctructures.CaseInsensitiveMapping`.
>
> It also includes updating tests and documentation to use this, rather
> than the old dict-like interface, i.e. `response.headers['Content-Type']
> = 'application/json'` `response['Content-Type'] = 'application/json'`.
>
> The dict-like interface won't be deprecated, but will become
> undocumented, and tests added purely for backwards-compatibility.
>
> [https://groups.google.com/u/2/g/django-developers/c/rlt1HhEaPaM Mailing
> list]
> [https://github.com/django/django/pull/13186 Draft PR]

New description:

This proposal is to replace `HttpResponse._headers` with
`HttpResponse.headers` as a public interface using a variation of
`django.utils.datasctructures.CaseInsensitiveMapping`.

It also includes updating tests and documentation to use this, rather than
the old dict-like interface, i.e. `response.headers['Content-Type'] =
'application/json'` `response['Content-Type'] = 'application/json'`.

The dict-like interface won't be deprecated, but will become undocumented,
and tests added purely for backwards-compatibility.

[https://groups.google.com/u/2/g/django-developers/c/rlt1HhEaPaM Mailing
list]
[https://github.com/django/django/pull/13186 PR]

--

--
Ticket URL: <https://code.djangoproject.com/ticket/31789#comment:5>

Django

unread,
Sep 11, 2020, 4:15:32 AM9/11/20
to django-...@googlegroups.com
#31789: Add a cleaner interface for response headers
-------------------------------------+-------------------------------------
Reporter: Tom Carrick | Owner: Tom
Type: | Carrick
Cleanup/optimization | Status: assigned
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/31789#comment:6>

Django

unread,
Sep 14, 2020, 3:51:56 AM9/14/20
to django-...@googlegroups.com
#31789: Add a cleaner interface for response headers
-------------------------------------+-------------------------------------
Reporter: Tom Carrick | Owner: Tom
Type: | Carrick
Cleanup/optimization | Status: closed

Component: HTTP handling | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"bcc2befd0e9c1885e45b46d0b0bcdc11def8b249" bcc2befd]:
{{{
#!CommitTicketReference repository=""
revision="bcc2befd0e9c1885e45b46d0b0bcdc11def8b249"
Fixed #31789 -- Added a new headers interface to HttpResponse.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31789#comment:7>

Reply all
Reply to author
Forward
0 new messages