Add simple "any" route to catch any method

This commit is contained in:
Alex Hultman
2019-01-22 13:55:28 +01:00
parent 6d469cd8ba
commit f4065b4e3b
3 changed files with 17 additions and 5 deletions
+3 -2
View File
@@ -268,8 +268,9 @@ public:
return std::move(*this);
}
TemplatedApp &&unhandled(std::function<void(HttpResponse<SSL> *, HttpRequest *)> handler) {
httpContext->onUnhandled(handler);
/* This one catches any method */
TemplatedApp &&any(std::string pattern, std::function<void(HttpResponse<SSL> *, HttpRequest *)> handler) {
httpContext->onHttp("*", pattern, handler);
return std::move(*this);
}