add auth
This commit is contained in:
24
context/context.go
Normal file
24
context/context.go
Normal 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user