diff --git a/master/lib/python3.6/site-packages/django/http/request.py b/ticket_30310/lib/python3.6/site-packages/django/http/request.py
index 02a127d..bcaf925 100644
old
|
new
|
class HttpHeaders(CaseInsensitiveMapping):
|
378 | 378 | headers[name] = value |
379 | 379 | super().__init__(headers) |
380 | 380 | |
| 381 | def __getitem__(self, key): |
| 382 | """ |
| 383 | Django template variables cannot contain hyphens, so to allow use |
| 384 | of the headers object in templates, we also try to look up the |
| 385 | variable with underscores. For example, use headers['foo-bar'] |
| 386 | in views, and {{ headers.foo_bar }} in templates. |
| 387 | """ |
| 388 | value = None |
| 389 | try: |
| 390 | value = super().__getitem__(key) |
| 391 | except KeyError: |
| 392 | value = super().__getitem__(key.replace('_', '-')) |
| 393 | return value |
| 394 | |
381 | 395 | @classmethod |
382 | 396 | def parse_header_name(cls, header): |
383 | 397 | if header.startswith(cls.HTTP_PREFIX): |