mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-15 13:02:14 +08:00
Update json.go
This commit is contained in:
parent
38af58eb9b
commit
db282b84cd
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user