mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-25 10:01:30 +00:00
clash-api: Fix bad redirect
This commit is contained in:
parent
27d6b63e71
commit
ceda5cc95d
|
@ -308,10 +308,11 @@ func authentication(serverSecret string) func(next http.Handler) http.Handler {
|
||||||
|
|
||||||
func hello(redirect bool) func(w http.ResponseWriter, r *http.Request) {
|
func hello(redirect bool) func(w http.ResponseWriter, r *http.Request) {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
if redirect {
|
contentType := r.Header.Get("Content-Type")
|
||||||
http.Redirect(w, r, "/ui/", http.StatusTemporaryRedirect)
|
if !redirect || contentType == "application/json" {
|
||||||
} else {
|
|
||||||
render.JSON(w, r, render.M{"hello": "clash"})
|
render.JSON(w, r, render.M{"hello": "clash"})
|
||||||
|
} else {
|
||||||
|
http.Redirect(w, r, "/ui/", http.StatusTemporaryRedirect)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue