mirror of
https://github.com/kataras/iris.git
synced 2026-02-27 21:15:56 +00:00
Give read access to the current route, a feature that many of you asked for
Former-commit-id: 39295ac1331ee08d3047c84f5c8ea152bce96781
This commit is contained in:
@@ -50,7 +50,7 @@ func NewRoute(method, subdomain, unparsedPath string,
|
||||
}
|
||||
|
||||
path = cleanPath(path) // maybe unnecessary here but who cares in this moment
|
||||
defaultName := method + subdomain + path
|
||||
defaultName := method + subdomain + tmpl.Src
|
||||
formattedPath := formatPath(path)
|
||||
|
||||
route := &Route{
|
||||
@@ -106,7 +106,7 @@ func (r *Route) BuildHandlers() {
|
||||
} // note: no mutex needed, this should be called in-sync when server is not running of course.
|
||||
}
|
||||
|
||||
// String returns the form of METHOD, SUBDOMAIN, TMPL PATH
|
||||
// String returns the form of METHOD, SUBDOMAIN, TMPL PATH.
|
||||
func (r Route) String() string {
|
||||
return fmt.Sprintf("%s %s%s",
|
||||
r.Method, r.Subdomain, r.Tmpl().Src)
|
||||
@@ -184,3 +184,19 @@ func (r Route) ResolvePath(args ...string) string {
|
||||
}
|
||||
return formattedPath
|
||||
}
|
||||
|
||||
type routeReadOnlyWrapper struct {
|
||||
*Route
|
||||
}
|
||||
|
||||
func (rd routeReadOnlyWrapper) Name() string {
|
||||
return rd.Route.Name
|
||||
}
|
||||
|
||||
func (rd routeReadOnlyWrapper) Subdomain() string {
|
||||
return rd.Route.Subdomain
|
||||
}
|
||||
|
||||
func (rd routeReadOnlyWrapper) Path() string {
|
||||
return rd.Route.tmpl.Src
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user