Skip to content

Commit

Permalink
Simplier healthcheck route and response.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbragagnolo committed Feb 13, 2023
1 parent 768e3ae commit 3f9a807
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func wrapper(fn func(w http.ResponseWriter, r *http.Request)) http.HandlerFunc {

func HealthCheckHandler(w http.ResponseWriter, r *http.Request) {
setStrHeader(w, "Content-Type", "text/plain")
io.WriteString(w, "WORKING\n")
io.WriteString(w, "OK\n")
}

func proxy(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -157,7 +157,7 @@ func main() {
}

r := mux.NewRouter()
r.HandleFunc("/healthcheck{_dummy:/?}", wrapper(HealthCheckHandler)).Methods("GET", "HEAD")
r.HandleFunc("/_health}", wrapper(HealthCheckHandler)).Methods("GET", "HEAD")
r.HandleFunc("/{bucket:[0-9a-zA-Z-_.]+}/{object:.*}", wrapper(proxy)).Methods("GET", "HEAD")

log.Printf("[service] listening on %s", *bind)
Expand Down

0 comments on commit 3f9a807

Please sign in to comment.