namespace samples {
public:
static constexpr std::string_view kName = "handler-multipart-sample";
using HttpHandlerBase::HttpHandlerBase;
};
if (content_type != "multipart/form-data") {
req.
GetHttpResponse().
SetStatus(server::http::HttpStatus::kBadRequest);
return "Expected 'multipart/form-data' content type";
}
static constexpr std::string_view kPngMagicBytes = "\x89PNG\r\n\x1a\n";
req.GetHttpResponse().
SetStatus(server::http::HttpStatus::kBadRequest);
return "Expecting PNG image format";
}
req.GetHttpResponse().
SetContentType(http::content_type::kApplicationJson);
return fmt::format("city={} image_size={}", json_addr["city"].As<std::string>(), image.value.size());
}
}
int main(int argc, char* argv[]) {
}