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

Method GetHostTemplate

route.go:721–729  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

719// against third-party services.
720// An error will be returned if the route does not define a host.
721func (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()

Callers 2

getRouteTemplateFunction · 0.80
testTemplateFunction · 0.80

Calls

no outgoing calls

Tested by 2

getRouteTemplateFunction · 0.64
testTemplateFunction · 0.64