mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 09:36:49 +03:00
Remove unnecessary bytes() calls (#6626)
This commit is contained in:
parent
6bd25c09a6
commit
b37aa284eb
|
@ -88,7 +88,7 @@ class JSONRenderer(BaseRenderer):
|
|||
Render `data` into JSON, returning a bytestring.
|
||||
"""
|
||||
if data is None:
|
||||
return bytes()
|
||||
return b''
|
||||
|
||||
renderer_context = renderer_context or {}
|
||||
indent = self.get_indent(accepted_media_type, renderer_context)
|
||||
|
|
|
@ -73,7 +73,7 @@ class Response(SimpleTemplateResponse):
|
|||
'renderer returned unicode, and did not specify '
|
||||
'a charset value.'
|
||||
)
|
||||
return bytes(ret.encode(charset))
|
||||
return ret.encode(charset)
|
||||
|
||||
if not ret:
|
||||
del self['Content-Type']
|
||||
|
|
|
@ -185,7 +185,7 @@ class APIRequestFactory(DjangoRequestFactory):
|
|||
|
||||
# Coerce text to bytes if required.
|
||||
if isinstance(ret, str):
|
||||
ret = bytes(ret.encode(renderer.charset))
|
||||
ret = ret.encode(renderer.charset)
|
||||
|
||||
return ret, content_type
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user