mirror of
https://github.com/kataras/iris.git
synced 2025-12-21 20:07:04 +00:00
minor
Former-commit-id: ee1b625abe876cad8f0f2801c279da684b539fce
This commit is contained in:
@@ -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 */)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user