From 909b6f36b88daeeedc6278cbbc856aec09da3291 Mon Sep 17 00:00:00 2001 From: Hashim Khan Date: Mon, 27 Jul 2026 17:37:37 +0500 Subject: [PATCH] Fix ShouldBindBodyWith example to use binding.JSON binding.Form does not implement BindingBody, so the docs example could not compile or run. Use binding.JSON instead. Fixes #3296 --- docs/doc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/doc.md b/docs/doc.md index d1c33b87..ce865171 100644 --- a/docs/doc.md +++ b/docs/doc.md @@ -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 {