GetHostTemplate 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 host.
()
| 719 | // against third-party services. |
| 720 | // An error will be returned if the route does not define a host. |
| 721 | func (r *Route) GetHostTemplate() (string, error) { |
| 722 | if r.err != nil { |
| 723 | return "", r.err |
| 724 | } |
| 725 | if r.regexp.host == nil { |
| 726 | return "", errors.New("mux: route doesn't have a host") |
| 727 | } |
| 728 | return r.regexp.host.template, nil |
| 729 | } |
| 730 | |
| 731 | // GetVarNames returns the names of all variables added by regexp matchers |
| 732 | // These can be used to know which route variables should be passed into r.URL() |
no outgoing calls