Changes between Initial Version and Version 1 of Ticket #32023, comment 3
- Timestamp:
- Feb 26, 2024, 6:20:54 AM (10 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #32023, comment 3
initial v1 6 6 7 7 Shouldn't `request.META.__setitem__` and `request.META.__delitem__` `del request.headers` to synchronize if the key starts with `"HTTP_"`? In the current code, if any middleware has peeked into `request.headers`, the data gets out of sync on mutation. 8 9 10 {{{ 11 >>> from django.http import HttpRequest 12 >>> req = HttpRequest() 13 >>> req.META 14 {} 15 >>> req.headers 16 {} 17 >>> req.META["HTTP_X_FOO"] = 'asdf' 18 >>> req.headers 19 {} 20 >>> req.headers 21 {} 22 >>> req2 = HttpRequest() 23 >>> req2.META["HTTP_X_FOO"] = 'asdf' 24 >>> req2.META 25 {'HTTP_X_FOO': 'asdf'} 26 >>> req2.headers 27 {'X-Foo': 'asdf'} 28 >>> del req2.META["HTTP_X_FOO"] 29 >>> req2.headers 30 {'X-Foo': 'asdf'} 31 }}}