|
|
|
@ -508,6 +508,19 @@ func (r *Route) URLPath(pairs ...string) (*url.URL, error) { |
|
|
|
}, nil |
|
|
|
}, nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// URLPathTemplate returns the template used to match against for the route
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// The route must have a path defined.
|
|
|
|
|
|
|
|
func (r *Route) URLPathTemplate() (string, error) { |
|
|
|
|
|
|
|
if r.err != nil { |
|
|
|
|
|
|
|
return "", r.err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if r.regexp == nil || r.regexp.path == nil { |
|
|
|
|
|
|
|
return "", errors.New("mux: route doesn't have a path") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return r.regexp.path.template, nil |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// prepareVars converts the route variable pairs into a map. If the route has a
|
|
|
|
// prepareVars converts the route variable pairs into a map. If the route has a
|
|
|
|
// BuildVarsFunc, it is invoked.
|
|
|
|
// BuildVarsFunc, it is invoked.
|
|
|
|
func (r *Route) prepareVars(pairs ...string) (map[string]string, error) { |
|
|
|
func (r *Route) prepareVars(pairs ...string) (map[string]string, error) { |
|
|
|
|