Improves unit tests

This commit is contained in:
Manu Mtz-Almeida
2015-04-08 02:58:35 +02:00
parent 67f8f6bb69
commit ac0ad2fed8
14 changed files with 784 additions and 624 deletions

View File

@ -25,14 +25,13 @@ func ErrorLogger() HandlerFunc {
return ErrorLoggerT(ErrorTypeAll)
}
func ErrorLoggerT(typ uint32) HandlerFunc {
func ErrorLoggerT(typ int) HandlerFunc {
return func(c *Context) {
c.Next()
if !c.Writer.Written() {
errs := c.Errors.ByType(typ)
if len(errs) > 0 {
c.JSON(-1, c.Errors)
if errs := c.Errors.ByType(typ); len(errs) > 0 {
c.JSON(-1, errs)
}
}
}