mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-15 21:06:39 +08:00
use a copy of the body in jsonBinding.Bind()
This commit is contained in:
parent
53fbf4dbfb
commit
9e22912ad2
@ -34,7 +34,11 @@ func (jsonBinding) Bind(req *http.Request, obj any) error {
|
||||
if req == nil || req.Body == nil {
|
||||
return errors.New("invalid request")
|
||||
}
|
||||
return decodeJSON(req.Body, obj)
|
||||
body, err := req.GetBody()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return decodeJSON(body, obj)
|
||||
}
|
||||
|
||||
func (jsonBinding) BindBody(body []byte, obj any) error {
|
||||
|
Loading…
x
Reference in New Issue
Block a user