mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-11 23:31:03 +00:00
re-re-arrange error checks
This commit is contained in:
parent
4ce3879e2c
commit
007b3ffc3c
1 changed files with 9 additions and 5 deletions
|
|
@ -478,6 +478,15 @@ func NewStatikHandler(h *Handler) statikHandler {
|
|||
}
|
||||
|
||||
func (s statikHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
if strings.HasPrefix(r.UserAgent(), "curl") {
|
||||
msg := "Welcome. Pilosa v" + s.handler.api.Version() + " is running. Visit https://www.pilosa.com/docs/ for more information."
|
||||
if s.statikFS != nil {
|
||||
msg += " Try the Web UI by visiting this URL in your browser."
|
||||
}
|
||||
http.Error(w, msg, http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
if s.statikFS == nil {
|
||||
msg := "Web UI is not available. Please run `make generate-statik` before building Pilosa with `make install`."
|
||||
s.handler.logger.Printf(msg)
|
||||
|
|
@ -485,11 +494,6 @@ func (s statikHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
if strings.HasPrefix(r.UserAgent(), "curl") {
|
||||
http.Error(w, "Welcome. Pilosa is running. Visit https://www.pilosa.com/docs/ for more information or try the Web UI by visiting this URL in your browser.", http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
// /vds is a front-end route, not a backend route. Without this check, refreshing at /vds
|
||||
// will request a nonexistent resource and return 404.
|
||||
if r.URL.String() == "/vds" {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue