Commit 1826084b authored by Darren Shepherd's avatar Darren Shepherd

Add ping handler

parent 804a341a
...@@ -32,6 +32,7 @@ func router(serverConfig *config.Control, tunnel http.Handler, cacertsGetter CAC ...@@ -32,6 +32,7 @@ func router(serverConfig *config.Control, tunnel http.Handler, cacertsGetter CAC
router.NotFoundHandler = authed router.NotFoundHandler = authed
router.Path("/cacerts").Handler(cacerts(cacertsGetter)) router.Path("/cacerts").Handler(cacerts(cacertsGetter))
router.Path("/openapi/v2").Handler(serveOpenapi()) router.Path("/openapi/v2").Handler(serveOpenapi())
router.Path("/ping").Handler(ping())
return router return router
} }
...@@ -100,3 +101,12 @@ func serveOpenapi() http.Handler { ...@@ -100,3 +101,12 @@ func serveOpenapi() http.Handler {
resp.Write(data) resp.Write(data)
}) })
} }
func ping() http.Handler {
return http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
data := []byte("pong")
resp.Header().Set("Content-Type", "text/plain")
resp.Header().Set("Content-Length", strconv.Itoa(len(data)))
resp.Write(data)
})
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment