1
0
mirror of synced 2025-07-29 11:01:13 +03:00

Improve multipart content reader interface

This commit is contained in:
yhirose
2019-12-02 07:11:12 -05:00
parent d910bfc303
commit 033bc35723
3 changed files with 31 additions and 29 deletions

View File

@ -121,14 +121,14 @@ svr.Post("/content_receiver",
if (req.is_multipart_form_data()) {
MultipartFiles files;
content_reader(
[&](const std::string &name, const MultipartFile &file) {
files.emplace(name, file);
return true;
},
[&](const std::string &name, const char *data, size_t data_length) {
auto &file = files.find(name)->second;
file.content.append(data, data_length);
return true;
},
[&](const std::string &name, const MultipartFile &file) {
files.emplace(name, file);
return true;
});
} else {
std::string body;