get方式
func hp(c *gin.Context) {
_ = c.Request.ParseForm()
allPath := c.Request.RequestURI
fmt.Println(allPath)
}
post方式
func Posts(c *gin.Context) {
_ = c.Request.ParseForm()
if len(c.Request.PostForm) == 0 {
// json模式的
data, _ := c.GetRawData()
body = string(data)
} else {
//fmt.Println("www模式")
//fmt.Println(c.Request.PostForm)
for k, v := range c.Request.PostForm {
for i := 0; i < len(v); i++ {
vValue := k + "=" + v[i] + "&"
body += vValue
}
}
//fmt.Println(body)
}
}
hhhh