Not include charset when charset is None (#7400)

This commit is contained in:
Minjae Kim 2020-07-07 17:58:32 +09:00 committed by GitHub
parent 36bd1b30d8
commit d46d5cbaaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -179,9 +179,11 @@ class APIRequestFactory(DjangoRequestFactory):
ret = renderer.render(data) ret = renderer.render(data)
# Determine the content-type header from the renderer # Determine the content-type header from the renderer
content_type = "{}; charset={}".format( content_type = renderer.media_type
renderer.media_type, renderer.charset if renderer.charset:
) content_type = "{}; charset={}".format(
content_type, renderer.charset
)
# Coerce text to bytes if required. # Coerce text to bytes if required.
if isinstance(ret, str): if isinstance(ret, str):