Supporting "jsonp" format
This commit is contained in:
parent
eabee8b502
commit
3ab09c4b2c
|
@ -29,11 +29,16 @@ func (c *BaseAPIController) SendError(errorCode int, message ...interface{}) {
|
||||||
|
|
||||||
func (c *BaseAPIController) SendResponse(response responses.Subsonic) {
|
func (c *BaseAPIController) SendResponse(response responses.Subsonic) {
|
||||||
f := c.GetString("f")
|
f := c.GetString("f")
|
||||||
if f == "json" {
|
switch f {
|
||||||
|
case "json":
|
||||||
w := &responses.JsonWrapper{Subsonic: response}
|
w := &responses.JsonWrapper{Subsonic: response}
|
||||||
c.Data["json"] = &w
|
c.Data["json"] = &w
|
||||||
c.ServeJSON()
|
c.ServeJSON()
|
||||||
} else {
|
case "jsonp":
|
||||||
|
w := &responses.JsonWrapper{Subsonic: response}
|
||||||
|
c.Data["jsonp"] = &w
|
||||||
|
c.ServeJSONP()
|
||||||
|
default:
|
||||||
c.Data["xml"] = &response
|
c.Data["xml"] = &response
|
||||||
c.ServeXML()
|
c.ServeXML()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue