mirror of
https://github.com/astaxie/beego.git
synced 2025-07-04 17:10:19 +00:00
fix a bug about json and xml
This commit is contained in:
@ -272,14 +272,16 @@ Helper function for serving Json, sets content type to application/json:
|
||||
```go
|
||||
func (this *AddController) Get() {
|
||||
mystruct := { ... }
|
||||
routes.ServeJson(w, &mystruct)
|
||||
this.Data["json"] = &mystruct
|
||||
this.ServeJson()
|
||||
}
|
||||
```
|
||||
Helper function for serving Xml, sets content type to application/xml:
|
||||
```go
|
||||
func (this *AddController) Get() {
|
||||
mystruct := { ... }
|
||||
routes.ServeXml(w, &mystruct)
|
||||
this.Data["xml"]=&mystruct
|
||||
this.ServeXml()
|
||||
}
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user