Skip to content

Would you be open to a feature to allow passing regex captures onto handlers #19

@8176135

Description

@8176135

I think it would be pretty nice to be able to do regex captures and have the arguments passed onto the handler. This would need to be on a separate struct from Route since captures cost more performance than just matches.
E.g.

RouterBuilder::new()
        .add(RouteWithCaptures::get("/hello/(?P<name>[^/]*)/?").using(request_handler))
...
fn request_handler(a: Request<Body>, args: HashMap<String,String>) {
...
}

This could also be a stepping stone for the

Todo: add the ability to distinguish requests by query parameters.

Would you be open to a PR implementing this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions