diff --git a/HISTORY.md b/HISTORY.md index 9c9ead6c..3e5b8c39 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -377,7 +377,9 @@ Other Improvements: - New builtin [JWT](https://github.com/kataras/iris/tree/master/middleware/jwt) middleware based on [square/go-jose](https://github.com/square/go-jose) featured with optional encryption to set claims with sensitive data when necessary. -- `Context.ReadForm` now can return an `iris.ErrEmptyForm` instead of `nil` when the new `Configuration.FireEmptyFormError` is true (or `iris.WithEmptyFormError`) on missing form body to read from. +- New `iris.RouteOverlap` route registration rule. `Party.SetRegisterRule(iris.RouteOverlap)` to allow overlapping across multiple routes for the same request subdomain, method, path. See [1536#issuecomment-643719922](https://github.com/kataras/iris/issues/1536#issuecomment-643719922). + +- `Context.ReadForm` now can return an `iris.ErrEmptyForm` instead of `nil` when the new `Configuration.FireEmptyFormError` is true (when `iris.WithEmptyFormError` is set) on missing form body to read from. - `Configuration.EnablePathIntelligence | iris.WithPathIntelligence` to enable path intelligence automatic path redirection on the most closest path (if any), [example]((https://github.com/kataras/iris/blob/master/_examples/routing/intelligence/main.go) diff --git a/_examples/request-body/read-form/main.go b/_examples/request-body/read-form/main.go index 1e309326..cb82ffe4 100644 --- a/_examples/request-body/read-form/main.go +++ b/_examples/request-body/read-form/main.go @@ -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 */) }