Replace all utils.Param* with req.Params
This commit is contained in:
@@ -14,7 +14,7 @@ import (
|
||||
"github.com/navidrome/navidrome/model"
|
||||
"github.com/navidrome/navidrome/server/public"
|
||||
"github.com/navidrome/navidrome/server/subsonic/responses"
|
||||
"github.com/navidrome/navidrome/utils"
|
||||
"github.com/navidrome/navidrome/utils/req"
|
||||
)
|
||||
|
||||
type searchParams struct {
|
||||
@@ -28,18 +28,19 @@ type searchParams struct {
|
||||
}
|
||||
|
||||
func (api *Router) getParams(r *http.Request) (*searchParams, error) {
|
||||
p := req.Params(r)
|
||||
var err error
|
||||
sp := &searchParams{}
|
||||
sp.query, err = requiredParamString(r, "query")
|
||||
sp.query, err = p.String("query")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sp.artistCount = utils.ParamInt(r, "artistCount", 20)
|
||||
sp.artistOffset = utils.ParamInt(r, "artistOffset", 0)
|
||||
sp.albumCount = utils.ParamInt(r, "albumCount", 20)
|
||||
sp.albumOffset = utils.ParamInt(r, "albumOffset", 0)
|
||||
sp.songCount = utils.ParamInt(r, "songCount", 20)
|
||||
sp.songOffset = utils.ParamInt(r, "songOffset", 0)
|
||||
sp.artistCount = p.IntOr("artistCount", 20)
|
||||
sp.artistOffset = p.IntOr("artistOffset", 0)
|
||||
sp.albumCount = p.IntOr("albumCount", 20)
|
||||
sp.albumOffset = p.IntOr("albumOffset", 0)
|
||||
sp.songCount = p.IntOr("songCount", 20)
|
||||
sp.songOffset = p.IntOr("songOffset", 0)
|
||||
return sp, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user