1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-17 09:57:01 +00:00

various improvements and new 'UseOnce' method - read HISTORY.md

This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-08-06 03:35:58 +03:00
parent 5d480dc801
commit 46a3a99adf
20 changed files with 147 additions and 221 deletions

View File

@@ -25,15 +25,8 @@ import (
func Version(version string) OptionFunc {
return func(c *ControllerActivator) {
c.Router().SetRegisterRule(router.RouteOverlap) // required for this feature.
c.Use(func(ctx *context.Context) {
if !versioning.Match(ctx, version) {
ctx.StopExecution()
return
}
ctx.Next()
})
// Note: Do not use a group, we need c.Use for the specific controller's routes.
c.Use(versioning.Handler(version))
}
}