alien
alien copied to clipboard
Problem with catch all url pattern
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.
@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.