r.GET("/user/save", func(ctx *gin.Context) { ctx.String(http.StatusOK, "this is a %s", "ms string response") })
r.GET("/user/save", func (ctx *gin.Context) { ctx.JSON(http.StatusOK, gin.H{ "success": true, }) })
type XmlUser struct { Id int64 `xml:"id"` Name string `xml:"name"` } r.GET("/user/save", func (ctx *gin.Context) { u := XmlUser{ Id: 11, Name: "zhangsan", } ctx.XML(http.StatusOK, u) })
r.GET("/user/save", func (ctx *gin.Context) { //ctx.File("./1.png") ctx.FileAttachment("./1.png", "2.png") })
r.GET("/user/save", func(ctx *gin.Context) { ctx.Header("test", "headertest") })
r.GET("/user/save", func(ctx *gin.Context) { ctx.Redirect(http.StatusMovedPermanently, "http://www.baidu.com") })
r.GET("/user/save", func(ctx *gin.Context) { ctx.YAML(200, gin.H{"name": "ms", "age": 19}) })