fix for BuildJSONWithRaw

This commit is contained in:
Pavel 2023-10-18 15:40:46 +03:00
parent 7f0709888c
commit 4bca4c491e

View File

@ -291,7 +291,7 @@ func BindJSONWithRaw(c *gin.Context, obj any) ([]byte, error) {
defer func() { _ = closer.Close() }() defer func() { _ = closer.Close() }()
data, err := io.ReadAll(closer) data, err := io.ReadAll(closer)
if err != nil { if err != nil {
return []byte, err return []byte{}, err
} }
c.Request.Body = io.NopCloser(bytes.NewReader(data)) c.Request.Body = io.NopCloser(bytes.NewReader(data))
return data, c.ShouldBindJSON(obj) return data, c.ShouldBindJSON(obj)