mirror of
https://github.com/CrowCpp/Crow.git
synced 2024-06-07 21:10:44 +00:00
updated catchall to use references instead of pointers
This commit is contained in:
parent
f779a0f8a4
commit
16ae11a4e3
@ -26,7 +26,7 @@
|
||||
#else
|
||||
#define CROW_ROUTE(app, url) app.route<crow::black_magic::get_parameter_tag(url)>(url)
|
||||
#endif
|
||||
#define CROW_CATCHALL_ROUTE(app) (*(app.catchall_route()))
|
||||
#define CROW_CATCHALL_ROUTE(app) app.catchall_route()
|
||||
|
||||
namespace crow
|
||||
{
|
||||
@ -88,7 +88,7 @@ namespace crow
|
||||
}
|
||||
|
||||
///Create a route for any requests without a proper route (**Use CROW_CATCHALL_ROUTE instead**)
|
||||
CatchallRule* catchall_route()
|
||||
CatchallRule& catchall_route()
|
||||
{
|
||||
return router_.catchall_rule();
|
||||
}
|
||||
|
@ -1057,7 +1057,7 @@ namespace crow
|
||||
return *ruleObject;
|
||||
}
|
||||
|
||||
CatchallRule* catchall_rule()
|
||||
CatchallRule& catchall_rule()
|
||||
{
|
||||
return catchall_rule_;
|
||||
}
|
||||
@ -1260,10 +1260,10 @@ namespace crow
|
||||
}
|
||||
}
|
||||
|
||||
if (catchall_rule_->has_handler())
|
||||
if (catchall_rule_.has_handler())
|
||||
{
|
||||
CROW_LOG_DEBUG << "Cannot match rules " << req.url << ". Redirecting to Catchall rule";
|
||||
catchall_rule_->handler_(req, res);
|
||||
catchall_rule_.handler_(req, res);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1328,7 +1328,7 @@ namespace crow
|
||||
}
|
||||
|
||||
private:
|
||||
CatchallRule* catchall_rule_ = new CatchallRule();
|
||||
CatchallRule catchall_rule_;
|
||||
|
||||
struct PerMethod
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user