Skip to content

Commit

Permalink
remove redundant handlerutil.Redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
sentriz committed Apr 28, 2024
1 parent 6ba342c commit 559c910
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
2 changes: 1 addition & 1 deletion cmd/gonic/gonic.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func main() {
mux.Handle("/admin/", http.StripPrefix("/admin", chain(ctrlAdmin)))
mux.Handle("/rest/", http.StripPrefix("/rest", chain(trim(ctrlSubsonic))))
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 {
mux.Handle("/debug/vars", expvar.Handler())
Expand Down
6 changes: 0 additions & 6 deletions handlerutil/handlerutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, message)
Expand Down

0 comments on commit 559c910

Please sign in to comment.