diff options
| author | Troon <mark@tranchant.co.uk> | 2019-05-09 15:26:52 +0100 |
|---|---|---|
| committer | Carlton Gibson <carlton.gibson@noumenal.es> | 2019-05-09 16:26:52 +0200 |
| commit | a3a4f5c1447b10cee63d9fee518d0d6b5b881846 (patch) | |
| tree | a7a8e4946509ee30cb99e4e318a5314ebaf0b95a /django/http/request.py | |
| parent | 48235ba807483fe349d2dc66aaeddc0d03f8b0d4 (diff) | |
Fixed #30310 -- Added support for looking up HttpHeaders.headers using underscores.
Diffstat (limited to 'django/http/request.py')
| -rw-r--r-- | django/http/request.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/django/http/request.py b/django/http/request.py index 1e1cc6c397..e62e2272b2 100644 --- a/django/http/request.py +++ b/django/http/request.py @@ -369,6 +369,10 @@ class HttpHeaders(CaseInsensitiveMapping): headers[name] = value super().__init__(headers) + def __getitem__(self, key): + """Allow header lookup using underscores in place of hyphens.""" + return super().__getitem__(key.replace('_', '-')) + @classmethod def parse_header_name(cls, header): if header.startswith(cls.HTTP_PREFIX): |
