it complies and crow updated

This commit is contained in:
moneroexamples 2016-09-06 18:34:07 +08:00
parent 9b3a27baa9
commit f9925d6c3b
20 changed files with 870 additions and 513 deletions

14
ext/crow/http_response.h Normal file → Executable file
View file

@ -14,9 +14,9 @@ namespace crow
template <typename Adaptor, typename Handler, typename ... Middlewares>
friend class crow::Connection;
int code{200};
std::string body;
json::wvalue json_value;
int code{200};
// `headers' stores HTTP headers.
ci_map headers;
@ -40,12 +40,12 @@ namespace crow
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(json::wvalue&& json_value) : json_value(std::move(json_value))
{
json_mode();
json_mode();
}
response(int code, std::string body) : body(std::move(body)), code(code) {}
response(const json::wvalue& json_value) : body(json::dump(json_value))
response(int code, std::string body) : code(code), body(std::move(body)) {}
response(const json::wvalue& json_value) : body(json::dump(json_value))
{
json_mode();
}
@ -95,7 +95,7 @@ namespace crow
if (!completed_)
{
completed_ = true;
if (complete_request_handler_)
{
complete_request_handler_();
@ -118,7 +118,7 @@ namespace crow
bool completed_{};
std::function<void()> complete_request_handler_;
std::function<bool()> is_alive_helper_;
//In case of a JSON object, set the Content-Type header
void json_mode()
{