net/http: support multipart/mixed in Request.MultipartReader() #23959
What did you do?
Ran https://play.golang.org/p/uW3bq_3Z6Ym then in the terminal:
What did you expect to see?
No errors from
What did you see instead?
If this feature request is accepted, I'd gladly submit a PR to fix it, testing locally the change doesn't have any side effect on current code that expects
The text was updated successfully, but these errors were encountered:
The motivation for https://golang.org/pkg/net/http/#Request.MultipartReader was so you could get file uploads from browsers easily.
What uses multipart/mixed?
And what's wrong with your "good" handler? That seems fine to me. That is, our underlying https://golang.org/pkg/mime/multipart/#Reader already supports what you want. You just don't like the convenience wrapper, but it's not clear why it's convenient.
It's also not clear that this is safe to do. Isn't multipart/mixed used when people are sending "alternatives"? I'd be a little concerned that code that previously was unprepared for such forms would now blindly accept it, without considering which alternative they want.
I'd prefer people to "opt-in" to the expanded set of allowed inputs by calling the underlying Reader constructor themselves.
@bradfitz my current use case is uploading a file + json metadata in one request rather than:
multipart/mixed is pretty much the same as multipart/form-data except each "part" can have different headers / content-type and it's generally used in SMTP, however few APIs use it here and there.
https://golang.org/pkg/net/http/#Request.MultipartReader already supports multipart/form-data, the underlying https://golang.org/pkg/mime/multipart/#Reader supports multipart/* in general.
edit you were thinking about