Opened 4 years ago

Closed 4 years ago

#31789 closed Cleanup/optimization (fixed)

Add a cleaner interface for response headers

Reported by: Tom Carrick Owned by: Tom Carrick
Component: HTTP handling Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tom Carrick)

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.

Mailing list
PR

Change History (7)

comment:1 by Tom Carrick, 4 years ago

Owner: changed from nobody to Tom Carrick
Status: newassigned

comment:2 by Tom Carrick, 4 years ago

Needs documentation: set
Needs tests: set

comment:3 by Tom Carrick, 4 years ago

Needs documentation: unset
Needs tests: unset
Version: 3.0master

comment:4 by Asif Saifuddin Auvi, 4 years ago

Triage Stage: UnreviewedAccepted

I believe this should be accepted

comment:5 by Tom Carrick, 4 years ago

Description: modified (diff)

comment:6 by Mariusz Felisiak, 4 years ago

Triage Stage: AcceptedReady for checkin

comment:7 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

Resolution: fixed
Status: assignedclosed

In bcc2befd:

Fixed #31789 -- Added a new headers interface to HttpResponse.

Note: See TracTickets for help on using tickets.
Back to Top