Supporting "jsonp" format

This commit is contained in:
Deluan 2016-03-02 23:58:35 -05:00
parent eabee8b502
commit 3ab09c4b2c
1 changed files with 7 additions and 2 deletions

View File

@ -29,11 +29,16 @@ func (c *BaseAPIController) SendError(errorCode int, message ...interface{}) {
func (c *BaseAPIController) SendResponse(response responses.Subsonic) {
f := c.GetString("f")
if f == "json" {
switch f {
case "json":
w := &responses.JsonWrapper{Subsonic: response}
c.Data["json"] = &w
c.ServeJSON()
} else {
case "jsonp":
w := &responses.JsonWrapper{Subsonic: response}
c.Data["jsonp"] = &w
c.ServeJSONP()
default:
c.Data["xml"] = &response
c.ServeXML()
}