diff --git a/README.md b/README.md index adea676..ed59828 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ All you need to give is just health check function returning cats `ValidationNel val response = Http().singleRequest(HttpRequest(uri = "http://localhost:8888/health")) - // status code is 200(OK) if healthy, 500(Internal Server Error) if unhealthy. + // status code is 200(OK) if healthy, 503(Service Unavailable) if unhealthy. // response body is empty by default for performance. // pass '?full=true' query parameter to see full check result as json. it would be similar to below. // Please see com.github.everpeace.healthchecks.HealthRoutesTest for various response patterns. diff --git a/core/src/main/scala/com/github/everpeace/healthchecks/route/HealthCheckRoutes.scala b/core/src/main/scala/com/github/everpeace/healthchecks/route/HealthCheckRoutes.scala index 341008f..e6b9419 100644 --- a/core/src/main/scala/com/github/everpeace/healthchecks/route/HealthCheckRoutes.scala +++ b/core/src/main/scala/com/github/everpeace/healthchecks/route/HealthCheckRoutes.scala @@ -54,7 +54,7 @@ object HealthCheckRoutes extends DecorateAsScala { private def status(s: Boolean) = if (s) "healthy" else "unhealthy" - private def statusCode(s: Boolean) = if (s) OK else InternalServerError + private def statusCode(s: Boolean) = if (s) OK else ServiceUnavailable private def toResultJson(check: HealthCheck, result: HealthCheckResult) = HealthCheckResultJson( diff --git a/core/src/test/scala/com/github/everpeace/healthchecks/HealthCheckRoutesTest.scala b/core/src/test/scala/com/github/everpeace/healthchecks/HealthCheckRoutesTest.scala index f6fd2b5..133de22 100644 --- a/core/src/test/scala/com/github/everpeace/healthchecks/HealthCheckRoutesTest.scala +++ b/core/src/test/scala/com/github/everpeace/healthchecks/HealthCheckRoutesTest.scala @@ -113,12 +113,12 @@ class HealthRoutesTest val failedFatal = healthCheck("test3")(throw new Exception("exception")) Get("/health") ~> HealthCheckRoutes.health(ok, failedButNonFatal, failedFatal) ~> check { - status shouldEqual InternalServerError + status shouldEqual ServiceUnavailable responseAs[String] shouldEqual "{}" } Get("/health?full=true") ~> HealthCheckRoutes.health(ok, failedButNonFatal, failedFatal) ~> check { - status shouldEqual InternalServerError + status shouldEqual ServiceUnavailable responseAs[String] shouldEqual """ |{