diff --git a/context/context.go b/context/context.go index e703c2d4..0e823034 100644 --- a/context/context.go +++ b/context/context.go @@ -2842,8 +2842,8 @@ func (ctx *Context) ReadYAML(outPtr interface{}) error { var ( // IsErrEmptyJSON reports whether the given "err" is caused by a - // Context.ReadJSON call when the request body - // didn't start with { or it was totally empty. + // Client.ReadJSON call when the request body was empty or + // didn't start with { or [. IsErrEmptyJSON = func(err error) bool { if err == nil { return false @@ -2858,8 +2858,9 @@ var ( return v.Offset == 0 && v.Error() == "unexpected end of JSON input" } - // when optimization is enabled, the jsoniter will report the following error: - return strings.Contains(err.Error(), "readObjectStart: expect {") + errMsg := err.Error() + // 3rd party pacakges: + return strings.Contains(errMsg, "readObjectStart: expect {") || strings.Contains(errMsg, "readArrayStart: expect [") } // IsErrPath can be used at `context#ReadForm` and `context#ReadQuery`. diff --git a/iris_guide.go b/iris_guide.go index a05f8781..aa5c49d1 100644 --- a/iris_guide.go +++ b/iris_guide.go @@ -557,6 +557,9 @@ func (s *step7) Run(runner Runner, configurators ...Configurator) error { // they will be called on interrupt signals too, // because Iris has a builtin mechanism to call server's shutdown on interrupt. for _, cb := range s.step6.closers { + if cb == nil { + continue + } cb() } }()