1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #32159 -- Ensured AsyncRequestFactory correctly sets headers.

This commit is contained in:
Carlton Gibson
2020-11-04 11:07:15 +01:00
committed by GitHub
parent c2d4926702
commit ebb08d1942
4 changed files with 36 additions and 3 deletions

View File

@@ -544,7 +544,13 @@ class AsyncRequestFactory(RequestFactory):
(b'content-type', content_type.encode('ascii')),
])
s['_body_file'] = FakePayload(data)
s.update(extra)
follow = extra.pop('follow', None)
if follow is not None:
s['follow'] = follow
s['headers'] += [
(key.lower().encode('ascii'), value.encode('latin1'))
for key, value in extra.items()
]
# If QUERY_STRING is absent or empty, we want to extract it from the
# URL.
if not s.get('query_string'):