-
Notifications
You must be signed in to change notification settings - Fork 64
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
Dispatching on empty string #33
Comments
Interesting. Well, that's definitely a bug. |
While working on fixing this, I came across an interesting question about the expected behavior here. Let's say we had the following routes. (defroute "/" []
(println "Home"))
(defroute "/users/:id" [id]
(println "User" id))
(defroute "*" []
(println "catch all"))
(secretary/dispatch! "") ; => should print "catch all" or "Home"?
Thoughts? |
Oh, good catch. I think
|
* when no index route an empty route would match first route not splat
Fixes #33 ensure routes have / at begining
So, I'm finally getting around to cleaning up some old code and upgrading secretary. The upgrade (from 1.1.0 to 1.2.1) broke our site, and I traced it to this particular change: our routes are all in the form of UPDATE: looks like the work @noprompt is doing here addresses this via a protocol? I agree that this could/should be handled by those using the library, so seems reasonable to use my hack for now and update when 2.0 is ready. |
@ddellacosta Hey Dave, we've been bitten by the same bug in the past but it didn't surface for us until I had been deep into the work for the next major version. Even though the branch hasn't been merged yet, we've used it in production and it works. The only reason it hasn't been merged yet is I simply haven't had enough time to update the README; that's it! Most of the information you would need to use it though is in the tests and the comments in that issue. Since I know there are this branch really needs to get merged and the next major version out the door, I will try very hard to find time this week to do it. |
@noprompt hey Joel, no worries of course, what I've got now should be totally workable for the time being. I'll hang on until that gets merged in, and of course don't feel any pressure to get things out the door from me! I appreciate all your work on this great lib. (EDIT: and will check out the code in that PR in the meantime to familiarize myself with how 2.0 will work.) |
I think the following dispatch should go into the "catch all" route, but it is going to the "users" route:
I suppose the use-case here is to catch the default home route, but I don't see the ability here.
The text was updated successfully, but these errors were encountered: