mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-23 01:57:55 +08:00
Update README.md
change `ShouldBindXML` to `ShouldBindJSON`
This commit is contained in:
parent
0da5b0c85a
commit
bcd5cc38ab
@ -557,7 +557,7 @@ func main() {
|
||||
// Example for binding JSON ({"user": "manu", "password": "123"})
|
||||
router.POST("/loginJSON", func(c *gin.Context) {
|
||||
var json Login
|
||||
if err := c.ShouldBindXML(&json); err != nil {
|
||||
if err := c.ShouldBindJSON(&json); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user