You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Putting the middleware on top of middleware list — as suggested by doc — doesn't allow next middlewares to potentially add/override HTTP headers through:
This is due to using django_guid.utils.get_id_from_header() in django_guid.middleware.process_incoming_request(), which triggers an earlier immutable HttpHeader object build, so any add/override headers intent has no impact.
Would be better to use request.META to get/set headers.
Anyway, I'm very happy to accept a fix with a test for this if you'd like to contribute. I will probably, unfortunately not be able to review for at least a week.
Describe the bug
Putting the middleware on top of middleware list — as suggested by doc — doesn't allow next middlewares to potentially add/override HTTP headers through:
This is due to using
django_guid.utils.get_id_from_header()
indjango_guid.middleware.process_incoming_request()
, which triggers an earlier immutableHttpHeader
object build, so any add/override headers intent has no impact.Would be better to use
request.META
to get/set headers.To Reproduce
Create a middleware
Add middleware after django_guid
Try to access the header in a view
Now retry by removing
"django_guid.middleware.guid_middleware"
fromMIDDLEWARE
.The text was updated successfully, but these errors were encountered: