diff options
Diffstat (limited to 'http_response.h')
-rw-r--r-- | http_response.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/http_response.h b/http_response.h index 392fe9c..eff1d0f 100644 --- a/http_response.h +++ b/http_response.h @@ -11,16 +11,19 @@ namespace crow json::wvalue json_value; int code{200}; std::unordered_map<std::string, std::string> headers; + response() {} explicit response(int code) : code(code) {} response(std::string body) : body(std::move(body)) {} response(json::wvalue&& json_value) : json_value(std::move(json_value)) {} response(const json::wvalue& json_value) : body(json::dump(json_value)) {} response(int code, std::string body) : body(std::move(body)), code(code) {} + response(response&& r) { *this = std::move(r); } + response& operator = (response&& r) { body = std::move(r.body); @@ -29,5 +32,20 @@ namespace crow headers = std::move(r.headers); return *this; } + + void send(const std::string& body_part) + { + body += body_part; + } + + void end() + { + } + + void end(const std::string& body_part) + { + body += body_part; + end(); + } }; } |