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.
()
| 650 | // against third-party services. |
| 651 | // An error will be returned if the route does not define a path. |
| 652 | func (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. |