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

Problem with catch all url pattern #5

Open
davidaq opened this issue Aug 24, 2018 · 2 comments
Open

Problem with catch all url pattern #5

davidaq opened this issue Aug 24, 2018 · 2 comments

Comments

@davidaq
Copy link

davidaq commented Aug 24, 2018

I like the simplicity and well documented nature of the little routing framework. Yet I found that the "catch all" routing pattern suggested in the document doesn't work at all (revision a9d769893b801081204defeb3466c3b13972edb4).

I eventually resolved the problem my self, and here's what I've done:

func (n *node) insert(pattern string, val *route) error {
   // ....
  Loop: for k, ch := range pattern { // add a label
    // ...
    swich ch {
       // ...
       case '*': 
          level = level.branch(ch, nil, nodeCatchAll) 
          break Loop // break here if meet a catch all
       // ...
    }
    // ...
  }

Another issue is that you use a csv like format to serialize parsed params, and this will cause parsing problem if there are , or : inside the matched url.

@gernest
Copy link
Owner

gernest commented Aug 25, 2018

@davidaq apologies , I missed this one. Can you please expand on what you mean by it is not working at all.

And how do I reproduce this?

Thanks.

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

No branches or pull requests

3 participants
@davidaq @gernest and others