You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
k3s/vendor/github.com/xiang90/probing/server.go

26 lines
364 B

package probing
import (
"encoding/json"
"net/http"
"time"
)
func NewHandler() http.Handler {
return &httpHealth{}
}
type httpHealth struct {
}
type Health struct {
OK bool
Now time.Time
}
func (h *httpHealth) ServeHTTP(w http.ResponseWriter, r *http.Request) {
health := Health{OK: true, Now: time.Now()}
e := json.NewEncoder(w)
e.Encode(health)
}