Skip to content

app/json VS querystring request leads to different data representations #1593

@vhermecz

Description

@vhermecz

Calling a restapi endpoint with:

  1. a querystring, causes BaseSerializer.from_native being called with a QueryDict.
  2. a body of application/json, causes BaseSerializer.from_native being called with a dict.

While this might not be a problem most of the times, but when it comes to a RelatedField with many=True, calling getlist for getting all of the values can offer some bad surprises...

Wondering if there is an easy fix for this.. (E.g.: adding a JsonDict type, which has a getlist wrapping scalars into a list or something, and wrapping return value of JSONParser.parse into it)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions