drogonframework / drogonframework/drogon
Support for form requests with both file and text fields
- Dominant language
- C++
- Stars
- 14.3k
- Forks
- 1.4k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 14
Description
**Describe the solution you'd like**
Support for text fields in `MultiPartParser` and an `HttpRequest` constructor option for multipart forms with both files and text fields.
**Additional context**
According to the [MDN docs](https://developer.mozilla.org/en-US/docs/Learn/Forms/Sending_and_retrieving_form_data#a_special_case_sending_files), in case of forms with files a multipart request is used, and the rest of the text fields are transmitted with one of the parts in URL encoded format.
As far as I know, the only constructor to create multipart requests is `newHttpFormPostRequest`, which only takes `UploadFile`s which are represented by paths on the filesystem, so the only way to post multipart requests with text fields seems to be by manually forming the multipart body, which is a unfortunate since it's tedious and the repo already has logic for it.
I'm not familiar enough with the repo to know what's the best way to implement this, but maybe with another multipart constructor that also takes in a vector of string key-value pairs?
Contributor guide
Assessment
This issue has not been assessed yet.