Skip to content

Automatically json.dumps when sending a dict in a multipart request #93

Open
@maingoh

Description

@maingoh

When sending a multipart request (with files) if we want to attach a metadata field or any field that is nested, currently the user should json.dumps it or it might be ignored by the server (hard to debug).
We should probably improve

data = self.dump_json_for_multipart(data)
so that the user can do:

Example:

client.http_helper.post(files={'file': open('file', 'rb')}, data={'metadata': {'foo': 'bar'}}, content_type=''multipart/mixed'')

Instead of:

client.http_helper.post(files={'file': open('file', 'rb')}, data={'metadata': json.dumps({'foo': 'bar'})}, content_type=''multipart/mixed'')

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