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

@ -761,14 +761,14 @@ protected:
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;
});
EXPECT_EQ(5u, files.size());