FindByMethodPath searched for matching route info by method and path
(method string, path string)
| 125 | |
| 126 | // FindByMethodPath searched for matching route info by method and path |
| 127 | func (r Routes) FindByMethodPath(method string, path string) (RouteInfo, error) { |
| 128 | if r == nil { |
| 129 | return RouteInfo{}, errors.New("route not found by method and path") |
| 130 | } |
| 131 | |
| 132 | for _, rr := range r { |
| 133 | if rr.Method == method && rr.Path == path { |
| 134 | return rr, nil |
| 135 | } |
| 136 | } |
| 137 | return RouteInfo{}, errors.New("route not found by method and path") |
| 138 | } |
| 139 | |
| 140 | // FilterByMethod searched for matching route info by method |
| 141 | func (r Routes) FilterByMethod(method string) (Routes, error) { |
no outgoing calls