Vojtěch Knyttl
11/19/2020, 11:37 PMContractRoute
with Path.string()
parameters? Basically, I can do:
val response = myContractRoute(request)
but when accessing Path.string()
parameters I am getting:
Request was not routed, so no uri-template present
I tried then with what I found in https://www.http4k.org/cookbook/test_driven_apps/:
val root = routes(myContractRoute)
but it seems the routes()
method cannot work with ContractRoute.
is there a way?dave
11/20/2020, 4:49 AMVojtěch Knyttl
11/20/2020, 9:40 AMval app = routes(contract { routes += myContractRoute })
val response = app(request)
still:
Request was not routed, so no uri-template present
dave
11/20/2020, 5:42 PM@Test
fun `test route`() {
val route = <http://Path.int|Path.int>().of("sue") bindContract GET to { path -> { Response(OK).body(path.toString()) } }
assertThat(route(Request(GET, "/123")), hasBody("123"))
}
Vojtěch Knyttl
11/20/2020, 7:32 PMrequest.path("sue")
- but path is empty within the tests.