Fix(API): use right status code

This commit is contained in:
Dreamacro 2019-09-08 22:33:52 +08:00
parent 9815010131
commit 60fdd82e2b
2 changed files with 2 additions and 2 deletions

View File

@ -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
} }

View File

@ -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)
}) })