1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-25 19:10:54 +00:00
This commit is contained in:
astaxie 2013-04-21 23:14:05 +08:00
parent b6f06a5559
commit 095e52b941

View File

@ -199,7 +199,7 @@ func (c *Controller) ServeJson() {
return return
} }
c.Ctx.SetHeader("Content-Length", strconv.Itoa(len(content)), true) c.Ctx.SetHeader("Content-Length", strconv.Itoa(len(content)), true)
c.Ctx.ContentType("json") ctx.ResponseWriter.Header().Set("Content-Type", "application/json")
c.Ctx.ResponseWriter.Write(content) c.Ctx.ResponseWriter.Write(content)
} }
@ -210,7 +210,7 @@ func (c *Controller) ServeXml() {
return return
} }
c.Ctx.SetHeader("Content-Length", strconv.Itoa(len(content)), true) c.Ctx.SetHeader("Content-Length", strconv.Itoa(len(content)), true)
c.Ctx.ContentType("xml") ctx.ResponseWriter.Header().Set("Content-Type", "application/xml")
c.Ctx.ResponseWriter.Write(content) c.Ctx.ResponseWriter.Write(content)
} }