1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-22 04:17:03 +00:00

implement #1536 with (SetRegisterRule(iris.RouteOverlap))

Former-commit-id: 2b5523ff3e2aab60dd83faa3c520b16a34916fbe
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-06-14 08:09:42 +03:00
parent 78a45163e3
commit ed5964716b
16 changed files with 210 additions and 24 deletions

View File

@@ -66,6 +66,9 @@ type Route struct {
// ReadOnly is the read-only structure of the Route.
ReadOnly context.RouteReadOnly
// OnBuild runs right before BuildHandlers.
OnBuild func(r *Route)
}
// NewRoute returns a new route based on its method,
@@ -186,6 +189,10 @@ func (r *Route) RestoreStatus() bool {
// at the `Application#Build` state. Do not call it manually, unless
// you were defined your own request mux handler.
func (r *Route) BuildHandlers() {
if r.OnBuild != nil {
r.OnBuild(r)
}
if len(r.beginHandlers) > 0 {
r.Handlers = append(r.beginHandlers, r.Handlers...)
r.beginHandlers = r.beginHandlers[0:0]