From db282b84cd4e469811a9a7567a6887ed1244985c Mon Sep 17 00:00:00 2001 From: nimrodishi <45099489+nimrodishi@users.noreply.github.com> Date: Wed, 10 Jan 2024 12:22:30 +0200 Subject: [PATCH] Update json.go --- binding/json.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/binding/json.go b/binding/json.go index cbc2c8da..887a31b5 100644 --- a/binding/json.go +++ b/binding/json.go @@ -34,6 +34,12 @@ func (jsonBinding) Bind(req *http.Request, obj any) error { if req == nil || req.Body == nil { return errors.New("invalid request") } + if req.GetBody == nil { + req.GetBody = func()(io.ReadCloser, error) { + var readerCopy io.ReadCloser = req.Body + return readerCopy, nil + } + } body, err := req.GetBody() if err != nil { return err