This commit is contained in:
sentriz
2019-04-01 00:59:47 +01:00
parent 5835e42695
commit b7c398f1eb
5 changed files with 235 additions and 1 deletions

24
context/context.go Normal file
View File

@@ -0,0 +1,24 @@
package context
import (
"github.com/sentriz/gonic/subsonic"
"github.com/labstack/echo"
)
type Subsonic struct {
echo.Context
}
func (c *Subsonic) Respond(code int, r *subsonic.Response) error {
format := c.QueryParams().Get("f")
switch format {
case "json":
return c.JSON(code, r)
case "jsonp":
callback := c.QueryParams().Get("callback")
return c.JSONP(code, callback, r)
default:
return c.XML(code, r)
}
}