本文整理汇总了C++中pistache::http::ResponseWriter::send方法的典型用法代码示例。如果您正苦于以下问题:C++ ResponseWriter::send方法的具体用法?C++ ResponseWriter::send怎么用?C++ ResponseWriter::send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pistache::http::ResponseWriter
的用法示例。
在下文中一共展示了ResponseWriter::send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: upload_file_handler
void PetApi::upload_file_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
try {
this->upload_file(request, response);
} catch (std::runtime_error & e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
}
}
示例2: logout_user_handler
void UserApi::logout_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
try {
this->logout_user(response);
} catch (std::runtime_error & e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
}
}
示例3: get_user_by_name_handler
void UserApi::get_user_by_name_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the path params
auto username = request.param(":username").as<std::string>();
try {
this->get_user_by_name(username, response);
} catch (std::runtime_error & e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
}
}
示例4: get_pet_by_id_handler
void PetApi::get_pet_by_id_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the path params
auto petId = request.param(":petId").as<int64_t>();
try {
this->get_pet_by_id(petId, response);
} catch (std::runtime_error & e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
}
}
示例5: find_pets_by_status_handler
void PetApi::find_pets_by_status_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the query params
auto status = request.query().get("status");
try {
this->find_pets_by_status(status, response);
} catch (std::runtime_error & e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
}
}
示例6: login_user_handler
void UserApi::login_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the query params
auto username = request.query().get("username");
auto password = request.query().get("password");
try {
this->login_user(username, password, response);
} catch (std::runtime_error & e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
}
}
示例7: delete_pet_handler
void PetApi::delete_pet_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the path params
auto petId = request.param(":petId").as<int64_t>();
// Getting the header params
auto apiKey = request.headers().tryGetRaw("api_key");
try {
this->delete_pet(petId, apiKey, response);
} catch (std::runtime_error & e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
}
}
示例8: add_pet_handler
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
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
}
}
示例9: create_users_with_list_input_handler
void UserApi::create_users_with_list_input_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the body param
std::vector user;
try {
nlohmann::json request_body = nlohmann::json::parse(request.body());
user.fromJson(request_body);
this->create_users_with_list_input(user, response);
} catch (std::runtime_error & e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
}
}
示例10: update_user_handler
void UserApi::update_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the path params
auto username = request.param(":username").as<std::string>();
// Getting the body param
User user;
try {
nlohmann::json request_body = nlohmann::json::parse(request.body());
user.fromJson(request_body);
this->update_user(username, user, response);
} catch (std::runtime_error & e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
}
}
示例11: update_pet_with_form
void PetApiImpl::update_pet_with_form(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response){
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
}
示例12: upload_file
void PetApiImpl::upload_file(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response){
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
}
示例13: update_pet
void PetApiImpl::update_pet(const std::shared_ptr<Pet> &pet, Pistache::Http::ResponseWriter &response) {
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
}
示例14: get_pet_by_id
void PetApiImpl::get_pet_by_id(const int64_t &petId, Pistache::Http::ResponseWriter &response) {
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
}
示例15: find_pets_by_tags
void PetApiImpl::find_pets_by_tags(const Pistache::Optional<std::string> &tags, Pistache::Http::ResponseWriter &response) {
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
}