Merge pull request #550 from lag945/examples_patch_20221021

Change one of example's routes to handle POST instead of GET.
This commit is contained in:
Igor Mróz 2022-10-29 23:21:47 +02:00 committed by GitHub
commit e3ba10df18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -81,15 +81,15 @@ int main()
// more json example
CROW_ROUTE(app, "/add_json")
([](const crow::request& req) {
auto x = crow::json::load(req.body);
if (!x)
return crow::response(400);
int sum = x["a"].i() + x["b"].i();
std::ostringstream os;
os << sum;
return crow::response{os.str()};
});
.methods("POST"_method)([](const crow::request& req) {
auto x = crow::json::load(req.body);
if (!x)
return crow::response(400);
int sum = x["a"].i() + x["b"].i();
std::ostringstream os;
os << sum;
return crow::response{os.str()};
});
CROW_ROUTE(app, "/params")
([](const crow::request& req) {