mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-03 08:46:55 +00:00
[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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user