Opened 14 years ago
Last modified 13 years ago
#15741 closed New feature
Class-based generic views dropped support for X-Object-* headers — at Version 1
Reported by: | Russell Keith-Magee | Owned by: | nobody |
---|---|---|---|
Component: | Generic views | Version: | 1.3 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
The function-based generic views use the django.core.xheaders.populate_xheaders method to attach a X-Object-Type and X-Object-Id header to responses served by a generic view. This debug information in the response
Django needs to either:
- Deprecate and remove populate_xheaders, or
- Add X-Object-Type and X-Object-Id header support to class-based generic views.
If we choose to do (2), then we can't just wrap the generic view response in populate_xheaders, because we don't have access to the response object at the time at which we determine the object that is in use. It will probably be necessary to add generic support to define headers anywhere in the lifespan of a request, and then apply those headers when the response is constructed; i.e., in much the same way that self.request is available throughout the lifespan of a request, make self.response_headers available throughout the lifespan of a request.