1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-21 20:07:04 +00:00
Former-commit-id: ee1b625abe876cad8f0f2801c279da684b539fce
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-06-14 09:25:19 +03:00
parent 4afef007a4
commit 9c739969f0
2 changed files with 10 additions and 5 deletions

View File

@@ -27,9 +27,12 @@ func main() {
app.Post("/form_action", func(ctx iris.Context) {
visitor := Visitor{}
err := ctx.ReadForm(&visitor)
if err != nil && !iris.IsErrPath(err) /* see: https://github.com/kataras/iris/issues/1157 */ {
ctx.StopWithError(iris.StatusInternalServerError, err)
return
if err != nil {
if !iris.IsErrPath(err) /* see: https://github.com/kataras/iris/issues/1157 */ ||
err == iris.ErrEmptyForm {
ctx.StopWithError(iris.StatusInternalServerError, err)
return
}
}
ctx.Writef("Visitor: %#v", visitor)
@@ -40,5 +43,5 @@ func main() {
ctx.Writef("Username: %s", username)
})
app.Listen(":8080")
app.Listen(":8080", iris.WithEmptyFormError /* returns ErrEmptyForm if the request form body was empty */)
}