Lookup allows the manual lookup of a method + path combo. This is e.g. useful to build a framework around this router. If the path was found, it returns the handle function and the path parameter values. Otherwise the third return value indicates whether a redirection to the same path with an extra
(method, path string)
| 318 | // values. Otherwise the third return value indicates whether a redirection to |
| 319 | // the same path with an extra / without the trailing slash should be performed. |
| 320 | func (r *Router) Lookup(method, path string) (Handle, Params, bool) { |
| 321 | if root := r.trees[method]; root != nil { |
| 322 | return root.getValue(path) |
| 323 | } |
| 324 | return nil, nil, false |
| 325 | } |
| 326 | |
| 327 | func (r *Router) allowed(path, reqMethod string) (allow string) { |
| 328 | allowed := make([]string, 0, 9) |