[cpp-pistache] Fix compilation of petstore for Pistache (#497)

* Fix compilation of petstore for Pistache
Add Map support

* Add support for ByteArray

* Add Support for ByteArray in cpprest

* Implement TODOs
This commit is contained in:
sunn
2018-07-20 16:04:25 +02:00
committed by William Cheng
parent 1b2d12286f
commit 97d6b71460
29 changed files with 284 additions and 68 deletions

View File

@@ -59,11 +59,14 @@ void PetApi::setupRoutes() {
void PetApi::add_pet_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the body param
Pet pet;
try {
nlohmann::json request_body = nlohmann::json::parse(request.body());
pet.fromJson(request_body);
this->add_pet(pet, response);
} catch (std::runtime_error & e) {
//send a 400 error
@@ -132,11 +135,14 @@ void PetApi::get_pet_by_id_handler(const Pistache::Rest::Request &request, Pista
void PetApi::update_pet_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the body param
Pet pet;
try {
nlohmann::json request_body = nlohmann::json::parse(request.body());
pet.fromJson(request_body);
this->update_pet(pet, response);
} catch (std::runtime_error & e) {
//send a 400 error