aboutsummaryrefslogtreecommitdiffstats
path: root/amalgamate
diff options
context:
space:
mode:
authoripknHama <ipknhama@gmail.com>2014-09-14 08:18:09 +0900
committeripknHama <ipknhama@gmail.com>2014-09-14 08:18:09 +0900
commitcfc3705ea4b53b30ad2022a7aa88aa752d85d2df (patch)
tree73e6ec68a88932d999e92c991cb437b79d09bad4 /amalgamate
parent6ee8bd992e6719d3cba7a0dba15602ea7060f022 (diff)
downloadcrow-cfc3705ea4b53b30ad2022a7aa88aa752d85d2df.tar.gz
crow-cfc3705ea4b53b30ad2022a7aa88aa752d85d2df.zip
update amalgamate
Diffstat (limited to 'amalgamate')
-rw-r--r--amalgamate/crow_all.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/amalgamate/crow_all.h b/amalgamate/crow_all.h
index 9e40013..3381670 100644
--- a/amalgamate/crow_all.h
+++ b/amalgamate/crow_all.h
@@ -5396,6 +5396,18 @@ namespace crow
ci_map headers;
std::string body;
+ void* middleware_context{};
+
+ request()
+ : method(HTTPMethod::GET)
+ {
+ }
+
+ request(HTTPMethod method, std::string url, ci_map headers, std::string body)
+ : method(method), url(std::move(url)), headers(std::move(headers)), body(std::move(body))
+ {
+ }
+
void add_header(std::string key, std::string value)
{
headers.emplace(std::move(key), std::move(value));
@@ -5406,7 +5418,6 @@ namespace crow
return crow::get_header_value(headers, key);
}
- void* middleware_context{};
};
}
@@ -5655,11 +5666,12 @@ namespace crow
{
if (!completed_)
{
+ completed_ = true;
+
if (complete_request_handler_)
{
complete_request_handler_();
}
- completed_ = true;
}
}
@@ -6648,7 +6660,6 @@ namespace crow
bool middleware_call_helper(Container& middlewares, request& req, response& res, Context& ctx)
{
using parent_context_t = typename Context::template partial<N-1>;
- using current_context_t = typename Context::template partial<N>;
before_handler_call<CurrentMW, Context, parent_context_t>(std::get<N>(middlewares), req, res, ctx, static_cast<parent_context_t&>(ctx));
if (res.is_completed())
@@ -6682,7 +6693,6 @@ namespace crow
typename std::enable_if<(N==0)>::type after_handlers_call_helper(Container& middlewares, Context& ctx, request& req, response& res)
{
using parent_context_t = typename Context::template partial<N-1>;
- using current_context_t = typename Context::template partial<N>;
using CurrentMW = typename std::tuple_element<N, typename std::remove_reference<Container>::type>::type;
after_handler_call<CurrentMW, Context, parent_context_t>(std::get<N>(middlewares), req, res, ctx, static_cast<parent_context_t&>(ctx));
}
@@ -6691,7 +6701,6 @@ namespace crow
typename std::enable_if<(N>0)>::type after_handlers_call_helper(Container& middlewares, Context& ctx, request& req, response& res)
{
using parent_context_t = typename Context::template partial<N-1>;
- using current_context_t = typename Context::template partial<N>;
using CurrentMW = typename std::tuple_element<N, typename std::remove_reference<Container>::type>::type;
after_handler_call<CurrentMW, Context, parent_context_t>(std::get<N>(middlewares), req, res, ctx, static_cast<parent_context_t&>(ctx));
after_handlers_call_helper<N-1, Context, Container>(middlewares, ctx, req, res);