clean up controllers

This commit is contained in:
sentriz
2020-03-26 00:57:56 +00:00
parent 59461552ae
commit b63428344a
7 changed files with 152 additions and 181 deletions

View File

@@ -84,9 +84,9 @@ func writeResp(w http.ResponseWriter, r *http.Request, resp *spec.Response) erro
return ew.err
}
type subsonicHandler func(r *http.Request) *spec.Response
type handlerSubsonic func(r *http.Request) *spec.Response
func (c *Controller) H(h subsonicHandler) http.Handler {
func (c *Controller) H(h handlerSubsonic) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
response := h(r)
if response == nil {
@@ -99,9 +99,9 @@ func (c *Controller) H(h subsonicHandler) http.Handler {
})
}
type subsonicHandlerRaw func(w http.ResponseWriter, r *http.Request) *spec.Response
type handlerSubsonicRaw func(w http.ResponseWriter, r *http.Request) *spec.Response
func (c *Controller) HR(h subsonicHandlerRaw) http.Handler {
func (c *Controller) HR(h handlerSubsonicRaw) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
response := h(w, r)
if response == nil {