gin获取前端发送的Request Payload的值
buf := make([]byte, 1024)
n, _ := c.Request.Body.Read(buf)
c.Request.Body = ioutil.NopCloser(bytes.NewReader(buf[:n]))
j := buf[0:n]
fmt.Println("body:", string(j)+"a") //获取到post传递过来的数据
admin_admin := models.Admin_admin{}
err := json.Unmarshal(j, &admin_admin)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(admin_admin.Username)