mirror of
https://github.com/kataras/iris.git
synced 2026-01-06 03:27:27 +00:00
Fix iris run main.go not worked properly on some editors. Add notes for next version. Read HISTORY.md
This commit is contained in:
15
context.go
15
context.go
@@ -162,6 +162,21 @@ func (ctx *Context) Next() {
|
||||
}
|
||||
}
|
||||
|
||||
// NextHandler returns the next handler in the chain (ctx.Middleware)
|
||||
// otherwise nil.
|
||||
// Notes:
|
||||
// If the result of NextHandler() will be executed then
|
||||
// the ctx.Pos (which is exported for these reasons) should be manually increment(++)
|
||||
// otherwise your app will visit twice the same handler.
|
||||
func (ctx *Context) NextHandler() Handler {
|
||||
nextPos := ctx.Pos + 1
|
||||
// check if it has a next middleware
|
||||
if nextPos < len(ctx.Middleware) {
|
||||
return ctx.Middleware[nextPos]
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// StopExecution just sets the .pos to 255 in order to not move to the next middlewares(if any)
|
||||
func (ctx *Context) StopExecution() {
|
||||
ctx.Pos = stopExecutionPosition
|
||||
|
||||
Reference in New Issue
Block a user