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

Support for anchor tag - currently pollutes results #10

Open
ibothwell opened this issue May 19, 2017 · 3 comments
Open

Support for anchor tag - currently pollutes results #10

ibothwell opened this issue May 19, 2017 · 3 comments

Comments

@ibothwell
Copy link

Love the library. Very simple to use. Did run into issues with anchors. if they are on the path then they leak into the produced results.

(def routes [["/" :root] ["/:id" :root-with-id]])
(def my-router (r/router routes))
(r/match my-router "/") ; [:root nil nil]
(r/match my-router "/?a=1") ; [:root nil {:a "1"}]
(r/match my-router "/?a=1#asdf") ; [:root nil {:a "1#asdf"}]
(r/match my-router "/#asdf") ; [:root-with-id {:id "#asdf"} nil]
(r/match my-router "/my-id#asdf") ; [:root-with-id {:id "my-id#asdf"} nil]
(r/match my-router "/my-id?a=1#asdf") ; [:root-with-id {:id "my-id"} {:a "1#asdf"}]

@niwinz
Copy link
Member

niwinz commented May 28, 2017

A PR with a fix is welcome!

@kennyjwilli
Copy link
Contributor

I am also interested in this. I assume we don't want to completely discard the anchor tag. @niwinz Where should the parsed anchor tag go in the result from match?

@kennyjwilli
Copy link
Contributor

Also worth noting that the behavior I see is different than the behavior shown in this issue's description:

(r/match (r/router [["/page1" :page1]])
         "/page1")
=> [:page1 nil nil]
(r/match (r/router [["/page1" :page1]])
         "/page1#anchor")
=> nil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants