mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Add ping handler
This commit is contained in:
parent
804a341a2c
commit
1826084b24
@ -32,6 +32,7 @@ func router(serverConfig *config.Control, tunnel http.Handler, cacertsGetter CAC
|
||||
router.NotFoundHandler = authed
|
||||
router.Path("/cacerts").Handler(cacerts(cacertsGetter))
|
||||
router.Path("/openapi/v2").Handler(serveOpenapi())
|
||||
router.Path("/ping").Handler(ping())
|
||||
|
||||
return router
|
||||
}
|
||||
@ -100,3 +101,12 @@ func serveOpenapi() http.Handler {
|
||||
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)
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user