Opened 4 years ago
Last modified 4 years ago
#31789 closed Cleanup/optimization
Add a cleaner interface for response headers — at Initial Version
Reported by: | Tom Carrick | Owned by: | nobody |
---|---|---|---|
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
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.