diff --git a/binder.go b/binder.go index e91d1dea..cb1f6a2d 100644 --- a/binder.go +++ b/binder.go @@ -36,6 +36,11 @@ func (b *binder) MaxMemory() int64 { } func (b *binder) Bind(r *http.Request, i interface{}) (err error) { + if r.Body == nil { + err = NewHTTPError(http.StatusBadRequest, "Requesr body can't be nil") + return + } + defer r.Body.Close() ct := r.Header.Get(ContentType) err = ErrUnsupportedMediaType switch {