Refactored responses, implemented getLicense

This commit is contained in:
Deluan
2016-02-24 11:29:26 -05:00
parent ed1a132d8e
commit 1a3f370ea6
9 changed files with 116 additions and 58 deletions
+2 -7
View File
@@ -3,19 +3,14 @@ package controllers
import (
"github.com/astaxie/beego"
"encoding/xml"
"github.com/deluan/gosonic/responses"
)
type PingResponse struct {
XMLName xml.Name `xml:"http://subsonic.org/restapi subsonic-response"`
Status string `xml:"status,attr"`
Version string `xml:"version,attr"`
}
type PingController struct{ beego.Controller }
// @router /rest/ping.view [get]
func (this *PingController) Get() {
response := &PingResponse{Status:"ok", Version: beego.AppConfig.String("apiversion")}
response := responses.NewSubsonic()
xmlBody, _ := xml.Marshal(response)
this.Ctx.Output.Body([]byte(xml.Header + string(xmlBody)))
}