From cc8c1ad450667c8f6f983ba4f0d640accdcb49cf Mon Sep 17 00:00:00 2001 From: neodarz Date: Tue, 10 Sep 2019 10:26:16 +0200 Subject: Little refactorisation --- api/umosapi.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'api') diff --git a/api/umosapi.cpp b/api/umosapi.cpp index 57716e9..f5d7003 100644 --- a/api/umosapi.cpp +++ b/api/umosapi.cpp @@ -146,9 +146,7 @@ void UmosapiService::Api::set_path(std::string route) { void UmosapiService::Api::set_method_handler(std::string http_word, const std::function< void ( const std::shared_ptr< restbed::Session > ) >& callback) { UmosapiService::Api::_resource->set_method_handler(http_word, callback); std::locale loc; - for (auto& c : http_word) { - c = tolower(c); - } + for (auto& c : http_word) { c = tolower(c); } UmosapiService::Api::_path.words.push_back(HttpWord{http_word}); UmosapiService::Api::_swagger["paths"][UmosapiService::Api::_path.name][http_word]["description"] = ""; UmosapiService::Api::_swagger["paths"][UmosapiService::Api::_path.name][http_word]["operationId"] = ""; @@ -160,7 +158,7 @@ void UmosapiService::Api::set_error_handler(const std::function< void(int, const } void UmosapiService::Api::publish() { - for (auto& http_word: UmosapiService::Api::_path.words) { + for (const auto& http_word: UmosapiService::Api::_path.words) { auto responses = UmosapiService::Api::_swagger["paths"][UmosapiService::Api::_path.name][http_word.name]["responses"]; if (responses.find("200") == responses.end()) { UmosapiService::Api::_swagger["paths"][UmosapiService::Api::_path.name][http_word.name]["responses"]["200"]["description"] = "All is fine."; @@ -202,7 +200,7 @@ void UmosapiService::Api::parameter(std::string name, std::string description, s parameter["in"] = "path"; } else { parameter["in"] = "body"; - for (auto& def: UmosapiService::Api::_definitions.defs) { + for (const auto& def: UmosapiService::Api::_definitions.defs) { if (def.name == schema ) { std::string schema_path = "#/definitions/"; parameter["schema"]["$ref"] = schema_path.append(schema); -- cgit v1.2.1