From 52a6ea0c581605ace8a46d5af21f474c54ba8edd Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sun, 18 Oct 2015 10:01:53 +0200 Subject: [PATCH] shorter version of speedy response --- speedy/response.hpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/speedy/response.hpp b/speedy/response.hpp index 0b1033228..424859d32 100644 --- a/speedy/response.hpp +++ b/speedy/response.hpp @@ -16,26 +16,18 @@ class Response : public http::Response public: using http::Response::Response; - std::string json_string(const rapidjson::Document& document) + void json(http::Status code, const rapidjson::Document& document) { rapidjson::StringBuffer strbuf; rapidjson::Writer writer(strbuf); document.Accept(writer); // TODO: error handling - auto str = strbuf.GetString(); - return str; - } - - void json(http::Status code, const rapidjson::Document& document) - { - auto str = json_string(document); - this->send(code, str); + this->send(code, strbuf.GetString()); } void json(const rapidjson::Document& document) { - auto str = json_string(document); - this->send(str); + this->json(http::Status::Ok, document); } };