summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorCarlton Gibson <carlton@noumenal.es>2020-11-04 11:07:15 +0100
committerGitHub <noreply@github.com>2020-11-04 11:07:15 +0100
commitebb08d19424c314c75908bc6048ff57c2f872269 (patch)
tree8bce4349ce1e49b86a2a1aaf3e440b7abdebf95e /django
parentc2d4926702045e342a668057f0a758eec9db9436 (diff)
Fixed #32159 -- Ensured AsyncRequestFactory correctly sets headers.
Diffstat (limited to 'django')
-rw-r--r--django/test/client.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/django/test/client.py b/django/test/client.py
index dfd443a83c..2d501e0da6 100644
--- a/django/test/client.py
+++ b/django/test/client.py
@@ -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'):