[cpp-pistache-server]: Fix build with pistache master branch (#10829)

* fix(cpp-pistache-server): meson/cmake build

* fix(cpp-pistache-server): Upgrade to C++17 and use std::optional

* feat(cpp-pistache-server): Disable running tests during build of nlohmann/json

* feat(samples): Update server/petstore/cpp-pistache
This commit is contained in:
sheabot
2021-11-13 19:15:42 -07:00
committed by GitHub
parent 70737fb1e6
commit f2fcff2945
18 changed files with 60 additions and 58 deletions

View File

@@ -211,19 +211,19 @@ void UserApi::login_user_handler(const Pistache::Rest::Request &request, Pistach
// Getting the query params
auto usernameQuery = request.query().get("username");
Pistache::Optional<std::string> username;
if(!usernameQuery.isEmpty()){
std::optional<std::string> username;
if(usernameQuery.has_value()){
std::string valueQuery_instance;
if(fromStringValue(usernameQuery.get(), valueQuery_instance)){
username = Pistache::Some(valueQuery_instance);
if(fromStringValue(usernameQuery.value(), valueQuery_instance)){
username = valueQuery_instance;
}
}
auto passwordQuery = request.query().get("password");
Pistache::Optional<std::string> password;
if(!passwordQuery.isEmpty()){
std::optional<std::string> password;
if(passwordQuery.has_value()){
std::string valueQuery_instance;
if(fromStringValue(passwordQuery.get(), valueQuery_instance)){
password = Pistache::Some(valueQuery_instance);
if(fromStringValue(passwordQuery.value(), valueQuery_instance)){
password = valueQuery_instance;
}
}