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

Missing parameters still fire routes #4

Closed
calebd opened this issue Feb 12, 2013 · 2 comments
Closed

Missing parameters still fire routes #4

calebd opened this issue Feb 12, 2013 · 2 comments
Labels
Milestone

Comments

@calebd
Copy link
Contributor

calebd commented Feb 12, 2013

This is a bit difficult to explain so I'll just use examples. I have a route setup for /users/:user_id which is triggered by the URL app://users/ but not app://users. In the first case, the paramter for user_id is /. It would be nice to see /users and /users/ be treated the same as neither pass the target route.

@joeldev
Copy link
Owner

joeldev commented Feb 12, 2013

What is the expected behavior here? In either case you aren't actually passing a parameter, so it isn't really a match for that route. You mention you'd like them to be treated the same, which makes sense to me only if "/users/" is treated as if it was "/users". I'm pretty sure that's what you're thinking as well, I just wanted to clarify before making any code changes.

@calebd
Copy link
Contributor Author

calebd commented Feb 12, 2013

Yeah that's right. Both of them lack a :user_id but the one with the trailing slash still triggers the route. So my handlers need to have checks in them to make sure that the ending parameter is not / before continuing. It would be nice to have this filtered out by the router itself.

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