Hello, any way to have details on the failure on a...
# http4k
r
Hello, any way to have details on the failure on a contract as it's the case with a lens ?
Copy code
data class TestData(val list: List<String>, val value: Int)
    @Test
    fun routeTest() {
        val lens = Body.auto<TestData>().toLens()
        val handler = { request: Request ->
            val reqBody = lens(request)
            lens.inject(reqBody.copy(value = reqBody.value + 1), Response(Status.OK))
        }

        val resp = DebuggingFilters.PrintRequestAndResponse()
                .then(ServerFilters.CatchLensFailure())
                .then(handler)(
                Request(Method.GET, "/")
                        .body("{\"value\": 10 }")
        )
        println("**************************************************")
        val testRoute = "/test" meta {
            summary = "Recherche des bundles éligibles"
            receiving(lens to TestData(listOf("Hello"), 1))
        } bindContract Method.GET to handler

        val appContract = DebuggingFilters.PrintRequestAndResponse().then(routes(
                contract {
                    routes += testRoute
                }
        ))

        val respContract = appContract(
                Request(Method.GET, "/test")
                        .body("{'value': 10 }")
        )

        println(respContract)
    }
when I call the non contract handler I get a message " 'body' must be object" but with the second one there's no explaination. Any way to get some details of why it failed ?