drogon
drogon copied to clipboard
Multipart data per-part Content-Type
HttpFileUploadRequest should support defining Content-Type for each part. That is, the current per-part header is of the form
content-disposition: form-data; name="<itemName>"; filename="<fileName>"
where itemName and fileName are filled from the corresponding fields of UploadFile, as seen in https://github.com/drogonframework/drogon/blob/master/lib/src/HttpRequestImpl.cc around line 282. However, the full format as described in https://www.ietf.org/rfc/rfc2388.txt also allows for a content-type -field, which is required by many APIs. In other words the full format should be
content-disposition: form-data; name="<itemName>"; filename="<fileName>"
content-type=<contentType>
where contentType could be for example "image/jpeg".
Suggested solution: add a new string field _contentType to UploadFile and if it's non-empty, add it to the corresponding part when building the multipart request.
Thanks for the feature request! I agree :+1:
Forgot to close this, resolved when PR #1279 was merged, thanks!