aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJaeseung Ha <ipknhama@gmail.com>2016-05-23 21:52:37 +0900
committerJaeseung Ha <ipknhama@gmail.com>2016-05-23 21:52:37 +0900
commitcb5ef23ef0f65a9d7a3085e3df67fca60df8a86b (patch)
tree52e73a6770a9eabe883b53b5de1af125f1356521 /include
parenteb5a3b55f9e9b4077be7caeac67b403d345dc2d1 (diff)
parent47673eaddc4a24826f1e03b55197636da786bda9 (diff)
downloadcrow-cb5ef23ef0f65a9d7a3085e3df67fca60df8a86b.tar.gz
crow-cb5ef23ef0f65a9d7a3085e3df67fca60df8a86b.zip
Merge pull request #107 from kumagi/master
defeat some warnings
Diffstat (limited to 'include')
-rw-r--r--include/http_response.h14
-rw-r--r--include/json.h4
2 files changed, 10 insertions, 8 deletions
diff --git a/include/http_response.h b/include/http_response.h
index a7b63bf..23f312a 100644
--- a/include/http_response.h
+++ b/include/http_response.h
@@ -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()
{
diff --git a/include/json.h b/include/json.h
index 7d840fa..c2ce20e 100644
--- a/include/json.h
+++ b/include/json.h
@@ -286,7 +286,9 @@ namespace crow
case type::String:
return boost::lexical_cast<int64_t>(start_, end_-start_);
default:
- throw std::runtime_error(strcat("expected number, got: ", get_type_str(t())));
+ const std::string msg = "expected number, got: "
+ + std::string(get_type_str(t()));
+ throw std::runtime_error(msg);
}
#endif
return boost::lexical_cast<int64_t>(start_, end_-start_);