diff --git a/router.go b/router.go index 469ef85..ddb4eac 100644 --- a/router.go +++ b/router.go @@ -112,14 +112,6 @@ func (r *Router) AddRoute(method string, path string, callback http.HandlerFunc) return } -// PathParams takes a path and returns the values for any path parameters -// in the path. -func (r *Router) PathParams(req *http.Request) (params map[string]string) { - params = req.Context().Value(paramKey).(map[string]string) - - return -} - // handler returns the handler to use for the given request, consulting r.Method, r.URL.Path. It // always returns a non-nil handler. // @@ -161,6 +153,14 @@ func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } +// PathParams takes a path and returns the values for any path parameters +// in the path. +func PathParams(req *http.Request) (params map[string]string) { + params = req.Context().Value(paramKey).(map[string]string) + + return +} + // addSegment create a new segment either as a child or as a parameter depending on whether the key // qualifies as a parameter. A pointer to the created segment is then returned. func addSegment(curr *segment, key string) (seg *segment) {