Skip to content

Multipart Files without requiring the field name #1878

@TekExplorer

Description

@TekExplorer

I am currently working on a generator that uses the http package not unlike retrofit, and i find myself in a rather unpleasant position of realizing that MultipartFile leaks the field name to what i consider the wrong place.

I could create my own file part class, but I think that the current api is kinda inconsistent, as the field names should only be relevant to the request, not the file contents/source.

I would suggest either combining both fields and files into Map<String, Object /*String | MultipartFile*/> fields or changing fields to be Map<String, MultipartFile> fields

This would be a breaking change, but i consider it better than what we have now, which i consider bad practice.

Especially since MultipartFile doesnt actually use the field name anywhere - its just a carrier, which could be better served as mentioned above.

Alternatively, provide a means of modifying the field, such as making it a mutable field rather than a parameter, or a copy/clone method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions