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.
()
| 636 | // against third-party services. |
| 637 | // An error will be returned if the route does not define a path. |
| 638 | func (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 |
no outgoing calls