mirror of
https://github.com/gin-gonic/gin.git
synced 2026-11-22 02:43:36 +08:00
Merge 909b6f36b88daeeedc6278cbbc856aec09da3291 into 0f09c3a9b4626d9fe9979cf4d0521d6ae32ab646
This commit is contained in:
commit
4108f601f5
@ -1623,7 +1623,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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user