Skip to content

Commit d326014

Browse files
kerokimsigvef
authored andcommitted
Not include charset when charset is None (encode#7400)
1 parent cecd18d commit d326014

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

rest_framework/test.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,11 @@ def _encode_data(self, data, format=None, content_type=None):
179179
ret = renderer.render(data)
180180

181181
# Determine the content-type header from the renderer
182-
content_type = "{}; charset={}".format(
183-
renderer.media_type, renderer.charset
184-
)
182+
content_type = renderer.media_type
183+
if renderer.charset:
184+
content_type = "{}; charset={}".format(
185+
content_type, renderer.charset
186+
)
185187

186188
# Coerce text to bytes if required.
187189
if isinstance(ret, str):

0 commit comments

Comments
 (0)