Error middleware does not write if the it is already written
This commit is contained in:
parent
598c78297c
commit
dcdf7b92f4
@ -29,10 +29,11 @@ func ErrorLoggerT(typ uint32) HandlerFunc {
|
|||||||
return func(c *Context) {
|
return func(c *Context) {
|
||||||
c.Next()
|
c.Next()
|
||||||
|
|
||||||
errs := c.Errors.ByType(typ)
|
if !c.Writer.Written() {
|
||||||
if len(errs) > 0 {
|
errs := c.Errors.ByType(typ)
|
||||||
// -1 status code = do not change current one
|
if len(errs) > 0 {
|
||||||
c.JSON(-1, c.Errors)
|
c.JSON(-1, c.Errors)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user