type User struct { Name string `json:"name"` Password int64 `json:"password"` } func Login(c *gin.Context) { json := User{} c.BindJSON(&json) log.Printf("%v",&json) c.JSON(http.StatusOK, gin.H{ "name": json.Name, "password": json.Password, }) }
go 接受post 请求
9 min read