Merge 909b6f36b88daeeedc6278cbbc856aec09da3291 into dcaa4296d111981ffb31ac3eba90bb63e1eb5ab9

This commit is contained in:
Hashim Khan 2026-08-16 14:46:50 +05:00 committed by GitHub
commit ed69be3207
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1582,7 +1582,7 @@ func SomeHandler(c *gin.Context) {
objA := formA{}
objB := formB{}
// This reads c.Request.Body and stores the result into the context.
if errA := c.ShouldBindBodyWith(&objA, binding.Form); errA == nil {
if errA := c.ShouldBindBodyWith(&objA, binding.JSON); errA == nil {
c.String(http.StatusOK, `the body should be formA`)
// At this time, it reuses body stored in the context.
} else if errB := c.ShouldBindBodyWith(&objB, binding.JSON); errB == nil {