mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-14 12:12:12 +08:00
Merge af0276fe98b2fe4aebf1a13fb9110fd82f26c7e6 into f05f966a0824b1d302ee556183e2579c91954266
This commit is contained in:
commit
591a7d8fa7
@ -5,6 +5,7 @@
|
||||
package gin
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"io"
|
||||
"log"
|
||||
@ -926,6 +927,10 @@ func (c *Context) ShouldBindBodyWith(obj any, bb binding.BindingBody) (err error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// close the body
|
||||
c.Request.Body.Close()
|
||||
// reset the body to the original unread state
|
||||
c.Request.Body = ioutil.NopCloser(bytes.NewBuffer(body))
|
||||
c.Set(BodyBytesKey, body)
|
||||
}
|
||||
return bb.BindBody(body, obj)
|
||||
|
Loading…
x
Reference in New Issue
Block a user