aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAntony Woods <acron1@gmail.com>2014-11-04 17:12:52 +0000
committerAntony Woods <acron1@gmail.com>2014-11-04 17:12:52 +0000
commit738d5d47b55fa612842060dfa4924abf476c0726 (patch)
tree4869beaf3d64e14666628f8acc89b15a27ada8d7 /include
parent4b3b8070e75ce0fc181e5c012c47da2a1e7a918e (diff)
downloadcrow-738d5d47b55fa612842060dfa4924abf476c0726.tar.gz
crow-738d5d47b55fa612842060dfa4924abf476c0726.zip
Responses constructed from json::wvalue now automatically set the appropriate Content-Type header
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)
{