go-urlrouter
go-urlrouter copied to clipboard
*splat routes failing
(since Go 1.1?)
calls to rest.Route or rest.RouteObjectMethod fail for *splat routes
rest.RouteObjectMethod("GET", "/users/*username", users, "GetUser")
problem is in the trie package:
} else if token[0] == '*' {
// *splat case
name := remaining
remaining = ""
if self.SplatChild == nil {
self.SplatChild = &node{}
self.SplatName = name
}
nextNode = self.SplatChild
token is arriving in urlencoded format so '*' is replaced with '%2A' and else if condition fails; does not affect :id parameters
Thanks for the bug report, this is definitely due to a bad handling of the urlencoded strings. I'm gonna fix it. Note that it also affects gp-json-rest.