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

Make *filepath optionally match #13

Open
prologic opened this issue Dec 29, 2022 · 1 comment
Open

Make *filepath optionally match #13

prologic opened this issue Dec 29, 2022 · 1 comment

Comments

@prologic
Copy link

I decided to use your library in a new project and discovered that if I have a route for /:name/tree/:ref/*path but the request path is only /foo/tree/main the route isn't matched and 404(s). I had to add an empty route for /:name/tree/:ref for things to work.

Can we make matching optional in this case? It seems logical that a *path indicate anything or nothing.

@prologic
Copy link
Author

Good friend of mine pointed out to me that I might have been bitten by what's noted in this comment:

muxie/mux.go

Lines 18 to 20 in 0eca9f6

// Note that since a pattern ending in a slash names a rooted subtree,
// the pattern "/*myparam" matches all paths not matched by other registered
// patterns, but not the URL with Path == "/", for that you would need the pattern "/".

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