Skip to content

Commit 87461f8

Browse files
feat: add HEAD method for health check APIs (#802)
The HEAD method is in addition to the GET method for liveness and readiness APIs Fixes #796
1 parent 0da46fa commit 87461f8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

server/src/handlers/http/modal/server.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,14 +368,20 @@ impl Server {
368368

369369
// get the live check
370370
// GET "/liveness" ==> Liveness check as per https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-a-liveness-command
371+
// HEAD "/liveness"
371372
pub fn get_liveness_factory() -> Resource {
372-
web::resource("/liveness").route(web::get().to(health_check::liveness))
373+
web::resource("/liveness")
374+
.route(web::get().to(health_check::liveness))
375+
.route(web::head().to(health_check::liveness))
373376
}
374377

375378
// get the readiness check
376379
// GET "/readiness" ==> Readiness check as per https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-readiness-probes
380+
// HEAD "/readiness"
377381
pub fn get_readiness_factory() -> Resource {
378-
web::resource("/readiness").route(web::get().to(health_check::readiness))
382+
web::resource("/readiness")
383+
.route(web::get().to(health_check::readiness))
384+
.route(web::head().to(health_check::readiness))
379385
}
380386

381387
// get the about factory

0 commit comments

Comments
 (0)