trout
2015-03-16
Parent:6c6ea726570a
trout/trie.go
Fix some crashes. When adding a branch, make sure that it has any characters at all before checking if it's a variable. Change the Router methods to be on the *Router pointer. We were having some problems with Router methods not setting properties correctly, but this fixed it. Check that the Endpoint.methods map is set before trying to map methods to Handlers. With these changes, trout is complete enough that it can run the benchmarks.
1.1 --- a/trie.go Mon Mar 16 00:10:38 2015 -0400 1.2 +++ b/trie.go Mon Mar 16 09:39:10 2015 -0400 1.3 @@ -89,6 +89,9 @@ 1.4 } 1.5 1.6 func (b *branch) setHandler(method string, handler http.Handler) { 1.7 + if b.methods == nil { 1.8 + b.methods = map[string]http.Handler{} 1.9 + } 1.10 b.methods[method] = handler 1.11 } 1.12