mirror of
https://github.com/kataras/iris.git
synced 2025-12-18 02:17:05 +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:
@@ -64,6 +64,10 @@ import (
|
||||
type Controller struct {
|
||||
// Name contains the current controller's full name.
|
||||
Name string
|
||||
|
||||
// Route is the current request context's route.
|
||||
Route context.RouteReadOnly
|
||||
|
||||
// contains the `Name` as different words, all lowercase,
|
||||
// without the "Controller" suffix if exists.
|
||||
// we need this as field because the activator
|
||||
@@ -178,6 +182,7 @@ func (c *Controller) RelTmpl() string {
|
||||
// It's called internally.
|
||||
// End-Developer can ovverride it but it still MUST be called.
|
||||
func (c *Controller) BeginRequest(ctx context.Context) {
|
||||
c.Route = ctx.GetCurrentRoute()
|
||||
// path and path params
|
||||
c.Path = ctx.Path()
|
||||
c.Params = ctx.Params()
|
||||
|
||||
Reference in New Issue
Block a user