Fix example code of `Bind Uri` (#2710)

Need to pass a string to `gin.H` to show a message correctly.
This commit is contained in:
y-yagi 2021-05-01 14:57:22 +09:00 committed by GitHub
parent 215c9ce231
commit 1acb459c10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -930,7 +930,7 @@ func main() {
route.GET("/:name/:id", func(c *gin.Context) {
var person Person
if err := c.ShouldBindUri(&person); err != nil {
c.JSON(400, gin.H{"msg": err})
c.JSON(400, gin.H{"msg": err.Error()})
return
}
c.JSON(200, gin.H{"name": person.Name, "uuid": person.ID})