-
Notifications
You must be signed in to change notification settings - Fork 531
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
Top level route "" fails with null pointer exception, and you can't use "/" as alternative #170
Comments
Empty route is not valid according to HTTP spec: http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html A request URI can either be:
The same document also states that the path MUST not be empty and if not present the root must be "/". We can however add some checks and at startup fail if |
Yes, the case was that we created a Router that is mounted under another router, so the HTTP spec doesn't really apply to configuring the nested router, and the code ended up with empty string which caused an index out of bounds exception. The other case didn't exist, I thought there was another case where route() and route(path) behaved differently for what they allowed, but don't seem to be able to find it again.
|
When your route is "" or "/" you have to call
router.route()
instead ofrouter.route(myPath)
which means if you are generically mounting things you have to constantly have an if statement to check the contents of myPath and callroute()
instead if empty or "/". insteadroute(myPath)
should allow "/" as a route path.The text was updated successfully, but these errors were encountered: