aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authoripkn <ipknhama@gmail.com>2014-11-05 03:07:15 +0900
committeripkn <ipknhama@gmail.com>2014-11-05 03:07:15 +0900
commitccc5845c3e52814d28a2baf2cd90c6cd67c58e2c (patch)
tree4869beaf3d64e14666628f8acc89b15a27ada8d7 /include
parent4b3b8070e75ce0fc181e5c012c47da2a1e7a918e (diff)
parent738d5d47b55fa612842060dfa4924abf476c0726 (diff)
downloadcrow-ccc5845c3e52814d28a2baf2cd90c6cd67c58e2c.tar.gz
crow-ccc5845c3e52814d28a2baf2cd90c6cd67c58e2c.zip
Merge pull request #36 from acron0/auto-json-content-type
Responses now auto to 'application/json' when constructed using json::wvalue
Diffstat (limited to 'include')
-rw-r--r--include/http_response.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/http_response.h b/include/http_response.h
index 7288cc3..807e6ac 100644
--- a/include/http_response.h
+++ b/include/http_response.h
@@ -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)
{