code: func (c *Check) ServeHTTP(w http.ResponseWriter, r *http.Request) {
  	// allow requests not intended for checks to pass through.
  	if r.URL.Path != "/ready" && r.URL.Path != "/health" {
  		if c.passthroughHandler != nil {
  			c.passthroughHandler.ServeHTTP(w, r)
  			return
  		}
  
  		// We cant handle this request.
  		w.WriteHeader(http.StatusNotFound)
  		return
  	}
  
  	msg := ""
  	status := http.StatusOK
  
  	var resp Response
  	switch r.URL.Path {
  	case "/ready":
  		resp = c.CheckReady(r.Context())
  	case "/health":
  		resp = c.CheckHealth(r.Context())
  	}
  
  	// Set the HTTP status if the check failed
  	if resp.Status == StatusFail {
  		// Normal state, the HTTP response status reflects the status-reported health.
  		status = http.StatusServiceUnavailable
  	}
  
  	b, err := json.MarshalIndent(resp, "", "  ")
  	if err != nil {
  		b = []byte(`{"message": "error marshaling response", "status": "fail"}`)
  		status = http.StatusInternalServerError
  	}
  	msg = string(b)
  	w.WriteHeader(status)
  	fmt.Fprintln(w, msg)
  }
docs: // ServeHTTP serves /ready and /health requests with the respective checks.