1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Refs #27795 -- Removed force_bytes() in django.test.client where possible.

This commit is contained in:
Tim Graham 2018-02-10 20:31:18 -05:00
parent 4206765a5b
commit b8a41a2872

View File

@ -310,7 +310,7 @@ class RequestFactory:
charset = match.group(1)
else:
charset = settings.DEFAULT_CHARSET
return force_bytes(data, encoding=charset)
return data.encode(charset)
def _encode_json(self, data, content_type):
"""
@ -409,7 +409,7 @@ class RequestFactory:
# If QUERY_STRING is absent or empty, we want to extract it from the URL.
if not r.get('QUERY_STRING'):
# WSGI requires latin-1 encoded strings. See get_path_info().
query_string = force_bytes(parsed[4]).decode('iso-8859-1')
query_string = parsed[4].encode().decode('iso-8859-1')
r['QUERY_STRING'] = query_string
return self.request(**r)