you can create a RoutedRequest and use that to tes...
# http4k
d
you can create a RoutedRequest and use that to test, or send the incoming request through a routing block first..
m
Ah
RoutedRequest
is what I needed, thanks. For reference:
Copy code
fun `Request with no contact id in path should return unauthorized`() {
    val next: HttpHandler = { Response(Status.OK).body("hello") }
    val r = RoutedRequest(Request(Method.GET, "/contact/$contactId"), UriTemplate.from("/contact/{notContactId}"))

    val response = service.isLinkedToContact.filter(next)(r)

    assertThat(response.status, equalTo(Status.UNAUTHORIZED))
    assertThat(response.bodyString(), equalTo("Contact id is required"))
}