gotham-rs / gotham

A flexible web framework that promotes stability, safety, security and speed.

Home Page:https://gotham.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add add_route_matcher for DelegateRouteBuilder

lucacasonato opened this issue · comments

It seems it is currently not possible to add a RouteMatcher to an entire subtree (I might have missed something).

I propose this API:

router.delegate("/*").add_route_matcher(MyMatcher::new()).to_router(my_sub_router);

After looking at the code for 5 minutes, this seems possible because in DelegateRouteBuilder::to_router, DelegatedRoute gets passed a matcher (currently just statically a AnyRouteMatcher::new(). With this API addition the matcher would be dynamic.