Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

routes::get_handler should treat a path parameter as a route definition #2461

Open
ewienik opened this issue Sep 29, 2024 · 0 comments
Open
Labels

Comments

@ewienik
Copy link

ewienik commented Sep 29, 2024

If a parameter is defined for an url it should be treat as part of an url in matching rules process. This test should pass:

SEASTAR_TEST_CASE(test_match_rule_order_with_param) {
    parameters param;
    routes route;

    handl* h1 = new handl();
    route.add(operation_type::GET, url("/hello").remainder("path"), h1);

    handl* h2 = new handl();
    route.add(operation_type::GET, url("/hello"), h2);
    
    auto rh = route.get_handler(GET, "/hello/path-arg", param);
    BOOST_REQUIRE_EQUAL(rh, h1);

    rh = route.get_handler(GET, "/hello", param);
    BOOST_REQUIRE_EQUAL(rh, h2);                           // <-- currently failed

    return make_ready_future<>();
}
@tchaikov tchaikov added the http label Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants