Skip to content

ORJSONRenderer is causing malformed response on 204 replies #8

@jsmolina

Description

@jsmolina

how to reproduce?

Just add this reply to any view:
return Response(status=status.HTTP_204_NO_CONTENT)

rest_framework/response.py
ret = renderer.render(self.data, accepted_media_type, context)
will return 'null', and it will end in a malformed http response.

It is not happening on rest_framework.renderers.JSONRenderer as it has:

def render(self, data, accepted_media_type=None, renderer_context=None):
        """
        Render `data` into JSON, returning a bytestring.
        """
        if data is None:
            return b''

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions