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

Method GetPathRegexp

route.go:652–660  ·  view source on GitHub ↗

GetPathRegexp returns the expanded regular expression used to match route path. 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

650// against third-party services.
651// An error will be returned if the route does not define a path.
652func (r *Route) GetPathRegexp() (string, error) {
653 if r.err != nil {
654 return "", r.err
655 }
656 if r.regexp.path == nil {
657 return "", errors.New("mux: route does not have a path")
658 }
659 return r.regexp.path.regexp.String(), nil
660}
661
662// GetQueriesRegexp returns the expanded regular expressions used to match the
663// route queries.

Callers 1

testRegexpFunction · 0.80

Calls

no outgoing calls

Tested by 1

testRegexpFunction · 0.64