mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-31 08:47:39 +00:00
Refactor the examples to compile with a C++11 compiler
This commit is contained in:
parent
48b47ef209
commit
4af5b1e441
3 changed files with 12 additions and 13 deletions
|
@ -105,7 +105,7 @@ int main(int argc, const char** argv)
|
|||
Server svr;
|
||||
#endif
|
||||
|
||||
svr.Post("/multipart", [](const auto& req, auto& res) {
|
||||
svr.Post("/multipart", [](const Request& req, Response& res) {
|
||||
auto body =
|
||||
dump_headers(req.headers) +
|
||||
dump_multipart_files(req.files);
|
||||
|
@ -113,14 +113,14 @@ int main(int argc, const char** argv)
|
|||
res.set_content(body, "text/plain");
|
||||
});
|
||||
|
||||
svr.set_error_handler([](const auto& /*req*/, auto& res) {
|
||||
svr.set_error_handler([](const Request& /*req*/, Response& res) {
|
||||
const char* fmt = "<p>Error Status: <span style='color:red;'>%d</span></p>";
|
||||
char buf[BUFSIZ];
|
||||
snprintf(buf, sizeof(buf), fmt, res.status);
|
||||
res.set_content(buf, "text/html");
|
||||
});
|
||||
|
||||
svr.set_logger([](const auto& req, const auto& res) {
|
||||
svr.set_logger([](const Request& req, const Response& res) {
|
||||
cout << log(req, res);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue