I would like to test my service, that have the following implementation:
val health: HttpRoutes[IO] = HttpRoutes.of[IO] {
case GET -> Root / "health" =>
Ok(Stream
.awakeEvery[IO](1.second)
.flatMap { _ =>
Stream
.eval[IO, ServerHealth](checkServers(checkKafkaHealth)(checkSapHealth))
.map(h => h.asJson)
})
}
and I would like test the service and I've tried as follows:
val req = Request[IO](method = Method.GET, uri = uri"/metric/health")
val res = MetricService(config)
.health(req)
The question is, how to get the value from the response body?