mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-16 05:16:35 +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 {
|
if req == nil || req.Body == nil {
|
||||||
return errors.New("invalid request")
|
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()
|
body, err := req.GetBody()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user