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
Wildcard parameter name #46
Comments
I guess the use case I was going for with the wildcard support was more like this: router := vestigo.NewRouter()
router.Get("/static/*", http.StripPrefix("/static/", http.FileServer(http.Dir("/static"))) Where we have a "match all after the *" situation. I am worried about confusion adding parameter names to the wildcard, because then we would have confusing situations like this: router := vestigo.NewRouter()
router.Get("/*wildcardparam1/foo", handler) This becomes confusing for two reasons, should the wildcard act like a I feel like wildcard parameters need only to be used to match to the end of URL, and if you need to access that wildcard parameter you can get it by means of If we could make named wildcard parameters less confusing, I would be up for adding support for it, but I feel like it will become confusing. |
Thanks for your answer. Indeed, wildcards only makes sense at the end of a pattern. I guess "_name" is fine, as long as it's documented. I just stumbled over this when switching to vestigo from httprouter, which does save the wildcard parameter by the name given after "*". |
@antoooon: I can appreciate that. I am going to tag this as documentation, and will add a note to the readme about this. Will that be okay? |
documented in readme and merged. closing. |
When adding a wildcard parameter (i.e. *param instead of :param), the parameter name will be "_name" instead of the parameter name given in the pattern.
The text was updated successfully, but these errors were encountered: