• Multipart/Urlencoded 表单

    Multipart/Urlencoded 表单

    1. func main() {
    2. router := gin.Default()
    3. router.POST("/form_post", func(c *gin.Context) {
    4. message := c.PostForm("message")
    5. nick := c.DefaultPostForm("nick", "anonymous")
    6. c.JSON(200, gin.H{
    7. "status": "posted",
    8. "message": message,
    9. "nick": nick,
    10. })
    11. })
    12. router.Run(":8080")
    13. }