remove redundant handlerutil.Redirect
This commit is contained in:
@@ -273,7 +273,7 @@ func main() {
|
|||||||
mux.Handle("/admin/", http.StripPrefix("/admin", chain(ctrlAdmin)))
|
mux.Handle("/admin/", http.StripPrefix("/admin", chain(ctrlAdmin)))
|
||||||
mux.Handle("/rest/", http.StripPrefix("/rest", chain(trim(ctrlSubsonic))))
|
mux.Handle("/rest/", http.StripPrefix("/rest", chain(trim(ctrlSubsonic))))
|
||||||
mux.Handle("/ping", chain(handlerutil.Message("ok")))
|
mux.Handle("/ping", chain(handlerutil.Message("ok")))
|
||||||
mux.Handle("/", chain(handlerutil.Redirect(resolveProxyPath("/admin/home"))))
|
mux.Handle("/", chain(http.RedirectHandler(resolveProxyPath("/admin/home"), http.StatusSeeOther)))
|
||||||
|
|
||||||
if *confExpvar {
|
if *confExpvar {
|
||||||
mux.Handle("/debug/vars", expvar.Handler())
|
mux.Handle("/debug/vars", expvar.Handler())
|
||||||
|
|||||||
@@ -56,12 +56,6 @@ func BasicCORS(next http.Handler) http.Handler {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func Redirect(to string) http.Handler {
|
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
http.Redirect(w, r, to, http.StatusSeeOther)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func Message(message string) http.Handler {
|
func Message(message string) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
fmt.Fprintln(w, message)
|
fmt.Fprintln(w, message)
|
||||||
|
|||||||
Reference in New Issue
Block a user