From ca7dd49dc600a8d2f3cc0dbccbfd7f81e15185a2 Mon Sep 17 00:00:00 2001 From: Daniel Wagner-Hall Date: Thu, 10 Sep 2015 17:14:53 +0100 Subject: [PATCH] speculator: Add /healthz endpoint --- scripts/speculator/main.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/speculator/main.go b/scripts/speculator/main.go index 22fb2ff2..3775ad86 100644 --- a/scripts/speculator/main.go +++ b/scripts/speculator/main.go @@ -220,5 +220,12 @@ func main() { } http.HandleFunc("/spec/", serveSpec) http.HandleFunc("/diff/rst/", serveRstDiff) + http.HandleFunc("/healthz", serveText("ok")) log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", *port), nil)) } + +func serveText(s string) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, req *http.Request) { + io.WriteString(w, s) + } +}