1
0
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:
Gerasimos (Makis) Maropoulos
2017-02-05 18:13:24 +02:00
parent 2a911a450c
commit 3430e24188
5 changed files with 155 additions and 30 deletions

View File

@@ -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