1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-20 03:17:04 +00:00
This commit is contained in:
Gerasimos (Makis) Maropoulos
2016-12-22 19:07:03 +02:00
parent 1f25e4335a
commit fe79fdea44
4 changed files with 32 additions and 8 deletions

View File

@@ -97,7 +97,7 @@ type (
Middleware Middleware // exported because is useful for debugging
session sessions.Session
// Pos is the position number of the Context, look .Next to understand
Pos uint8 // exported because is useful for debugging
Pos int // exported because is useful for debugging
}
)
@@ -116,7 +116,7 @@ func (ctx *Context) Do() {
func (ctx *Context) Next() {
//set position to the next
ctx.Pos++
midLen := uint8(len(ctx.Middleware))
midLen := len(ctx.Middleware)
//run the next
if ctx.Pos < midLen {
ctx.Middleware[ctx.Pos].Serve(ctx)
@@ -1365,6 +1365,13 @@ func (ctx *Context) BeginTransaction(pipe func(scope *TransactionScope)) {
// and replaces the context's response with an error.
// if the transaction completed successfully then we need to pass the temp's context's response to this context.
// so we must copy back its context at all cases, no matter the result of the transaction.
// TODO: GREEK, THESE COMMENTS WILL BE REMOVED AFTER I FIX A RECENT BUG REPORTED BY COMMUNITY
// auto to xreiazomaste gia na pianei ta errors kiolas, ara prepei na vrw allous tropous
// na manteuw an 9elei o xristis na dixnei errors sto transaction h apla na to kanei skip
// alla tautoxrona ena failed transaction sto telos na mh kanei reset ta proigoumena, gt twra auto kanei,
// kai auto xreiazete omws se arketes periptwseis alla prepei kiolas na diaxwrizw to ka9e transaction na einai aneksartita
// pisteuw to Response.Reset dn 9a mas xreiastei ka9olou, prepei na ktlvenw mono pote xreiazete na kanw copy to scope's context kai pote oxi.
*ctx = *scope.Context
// if the scope had lifetime of the whole request and it completed with an error(failure)