MCPcopy
hub / github.com/gorilla/mux / GetPathTemplate

Method GetPathTemplate

route.go:638–646  ·  view source on GitHub ↗

GetPathTemplate returns the template used to build the route match. This is useful for building simple REST API documentation and for instrumentation against third-party services. An error will be returned if the route does not define a path.

()

Source from the content-addressed store, hash-verified

636// against third-party services.
637// An error will be returned if the route does not define a path.
638func (r *Route) GetPathTemplate() (string, error) {
639 if r.err != nil {
640 return "", r.err
641 }
642 if r.regexp.path == nil {
643 return "", errors.New("mux: route doesn't have a path")
644 }
645 return r.regexp.path.template, nil
646}
647
648// GetPathRegexp returns the expanded regular expression used to match route path.
649// This is useful for building simple REST API documentation and for instrumentation

Callers 3

TestWalkSubroutersFunction · 0.80
getRouteTemplateFunction · 0.80
testTemplateFunction · 0.80

Calls

no outgoing calls

Tested by 3

TestWalkSubroutersFunction · 0.64
getRouteTemplateFunction · 0.64
testTemplateFunction · 0.64