We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f6a0194 commit 7007fecCopy full SHA for 7007fec
experimental/clashapi/server.go
@@ -277,10 +277,11 @@ func authentication(serverSecret string) func(next http.Handler) http.Handler {
277
278
func hello(redirect bool) func(w http.ResponseWriter, r *http.Request) {
279
return func(w http.ResponseWriter, r *http.Request) {
280
- if redirect {
281
- http.Redirect(w, r, "/ui/", http.StatusTemporaryRedirect)
282
- } else {
+ contentType := r.Header.Get("Content-Type")
+ if !redirect || contentType == "application/json" {
283
render.JSON(w, r, render.M{"hello": "clash"})
+ } else {
284
+ http.Redirect(w, r, "/ui/", http.StatusTemporaryRedirect)
285
}
286
287
0 commit comments