From 738d5d47b55fa612842060dfa4924abf476c0726 Mon Sep 17 00:00:00 2001 From: Antony Woods Date: Tue, 4 Nov 2014 17:12:52 +0000 Subject: Responses constructed from json::wvalue now automatically set the appropriate Content-Type header --- include/http_response.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include') 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) { -- cgit v1.2.3-54-g00ecf