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

Matching breaks when the routes are similar #18

Closed
jertje260 opened this issue Oct 13, 2021 · 1 comment
Closed

Matching breaks when the routes are similar #18

jertje260 opened this issue Oct 13, 2021 · 1 comment

Comments

@jertje260
Copy link
Contributor

jertje260 commented Oct 13, 2021

If you configure two routes where the second one contains the complete part of the first, the matching doesn't work.

        [Fact]
        public void GivenRoutesStartingSimilarly_TheRightMatchingRequestIsReturned()
        {
            var routes = new List<RequestBuilder>
            {
                new RequestBuilder(HttpMethod.Get, "/api/foos/{id}", null),
                new RequestBuilder(HttpMethod.Get, "/api/foos/{id}/blas", null)
            };

            var dictionary = RouteDictionary.From(routes);

            dictionary
                .Match(
                    HttpMethod.Get,
                    "/api/foos/1234")
                .Should()
                .Be(routes[1]);
        }

This test fails while the reverse order of the list does succeed.

I am already trying to create a fix for this.

EDIT, this route matching does seem to work, should be routes[0]

@jertje260
Copy link
Contributor Author

So this is not the root cause of the issue where it doesn't seem to work for us. I will see where it comes from then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant