Health check looks at /v3/HealthCheck and handles http status properly
diff --git a/api/api.go b/api/api.go
index 317690d..13b8573 100644
--- a/api/api.go
+++ b/api/api.go
@@ -135,11 +135,13 @@
defer utils.LogFlow("Health Check", "End")
// See if we get a response.
- _, err := conn.client.Get(conn.getURL(""))
+ resp, err := conn.client.Get(conn.getURL("/v3/HealthCheck"))
if err != nil {
- return fmt.Errorf("could not complete health check: %v", err)
+ return fmt.Errorf("Health check failed to connect to server: %v", err)
+ } else if resp.StatusCode != 200 {
+ return fmt.Errorf("Health check returned unhealthy status: %s", resp.Status)
}
- log.Println("health check success!")
+ log.Printf("health check success! Got status: %s", resp.Status)
return nil
}