mirror of https://github.com/Dreamacro/clash.git
Fix(API): use right status code
This commit is contained in:
parent
9815010131
commit
60fdd82e2b
|
@ -119,7 +119,7 @@ func getProxyDelay(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
elm := picker.Wait()
|
elm := picker.Wait()
|
||||||
if elm == nil {
|
if elm == nil {
|
||||||
render.Status(r, http.StatusRequestTimeout)
|
render.Status(r, http.StatusGatewayTimeout)
|
||||||
render.JSON(w, r, ErrRequestTimeout)
|
render.JSON(w, r, ErrRequestTimeout)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ func Start(addr string, secret string) {
|
||||||
if uiPath != "" {
|
if uiPath != "" {
|
||||||
r.Group(func(r chi.Router) {
|
r.Group(func(r chi.Router) {
|
||||||
fs := http.StripPrefix("/ui", http.FileServer(http.Dir(uiPath)))
|
fs := http.StripPrefix("/ui", http.FileServer(http.Dir(uiPath)))
|
||||||
r.Get("/ui", http.RedirectHandler("/ui/", 301).ServeHTTP)
|
r.Get("/ui", http.RedirectHandler("/ui/", http.StatusTemporaryRedirect).ServeHTTP)
|
||||||
r.Get("/ui/*", func(w http.ResponseWriter, r *http.Request) {
|
r.Get("/ui/*", func(w http.ResponseWriter, r *http.Request) {
|
||||||
fs.ServeHTTP(w, r)
|
fs.ServeHTTP(w, r)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue