Skip to content

Commit

Permalink
-adjusted the router to the new whaleroute route matching signature
Browse files Browse the repository at this point in the history
  • Loading branch information
kamchatka-volcano committed Jan 4, 2024
1 parent 10254da commit fa6fd13
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/example_guestbook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct RouteContext {

template<>
struct asyncgi::config::RouteMatcher<AccessRole, RouteContext> {
bool operator()(AccessRole value, const asyncgi::Request&, asyncgi::Response&, RouteContext& context) const
bool operator()(AccessRole value, const asyncgi::Request&, const RouteContext& context) const
{
return value == context.role;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/example_route_matcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct LoginPageAuthorize {

template<>
struct asyncgi::config::RouteMatcher<AccessRole, RouteContext> {
bool operator()(AccessRole value, const asyncgi::Request&, asyncgi::Response&, RouteContext& context) const
bool operator()(AccessRole value, const asyncgi::Request&, const RouteContext& context) const
{
return value == context.role;
}
Expand Down
5 changes: 2 additions & 3 deletions include/asyncgi/router.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,15 @@ class Router : public whaleroute::RequestRouter<Request, Response, detail::Respo

template<>
struct config::RouteMatcher<asyncgi::http::RequestMethod> {
bool operator()(asyncgi::http::RequestMethod value, const asyncgi::Request& request, asyncgi::Response&) const
bool operator()(asyncgi::http::RequestMethod value, const asyncgi::Request& request) const
{
return value == request.method();
}
};

template<typename TContext>
struct config::RouteMatcher<asyncgi::http::RequestMethod, TContext> {
bool operator()(asyncgi::http::RequestMethod value, const asyncgi::Request& request, asyncgi::Response&, TContext&)
const
bool operator()(asyncgi::http::RequestMethod value, const asyncgi::Request& request, const TContext&) const
{
return value == request.method();
}
Expand Down

0 comments on commit fa6fd13

Please sign in to comment.