mirror of
https://github.com/kataras/iris.git
synced 2026-01-24 04:15:56 +00:00
replace all common error responses with the new Context.StopWithError
Former-commit-id: 99b08a0b5564ef640456db12674cb37721f73ae3
This commit is contained in:
@@ -16,6 +16,7 @@ func main() {
|
||||
ctx.StatusCode(iris.StatusNoContent)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Next()
|
||||
} // or "github.com/iris-contrib/middleware/cors"
|
||||
|
||||
@@ -25,8 +26,7 @@ func main() {
|
||||
var any iris.Map
|
||||
err := ctx.ReadJSON(&any)
|
||||
if err != nil {
|
||||
ctx.WriteString(err.Error())
|
||||
ctx.StatusCode(iris.StatusBadRequest)
|
||||
ctx.StopWithError(iris.StatusBadRequest, err)
|
||||
return
|
||||
}
|
||||
ctx.Application().Logger().Infof("received %#+v", any)
|
||||
|
||||
Reference in New Issue
Block a user