Merge pull request #36 from acron0/auto-json-content-type

Responses now auto to 'application/json' when constructed using json::wvalue
This commit is contained in:
ipkn 2014-11-05 03:07:15 +09:00
commit ccc5845c3e
2 changed files with 755 additions and 735 deletions

File diff suppressed because it is too large Load Diff

View File

@ -41,8 +41,11 @@ namespace crow
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(const json::wvalue& json_value) : body(json::dump(json_value))
{
set_header("Content-Type", "application/json");
}
response(response&& r)
{