Hey, When I try to update from version `6.0.1.0`...
# http4k
d
Hey, When I try to update from version
6.0.1.0
to
6.1.0.0
I run into
java.lang.IllegalStateException: Request was not routed, so no uri-template present
. What I’m doing wrong here?
Copy code
class AppHttpFilterShould {
    @Test
    fun `extract customer id for logging`() {
        var receivedRequest = Request(GET, "")
        val app = routes(
            "/v1/customer/{id}" bind GET to { receivedRequest = it; Response(OK) },
            "/v1/customer/{other-id}/{x}" bind GET to { receivedRequest = it; Response(OK) },
        )
        val request = Request(GET, "/v1/customer/407")

        app(request)

        receivedRequest.identifier() shouldBe Identifier.CustomerId("407")
    }
}

sealed interface Identifier {
    data class CustomerId(val id: String) : Identifier
    data class CompanyId(val id: String, val x: String) : Identifier
    data object NoId : Identifier
}

fun Request.identifier(): Identifier {
    val id = path("id").orEmpty()
    val otherId = path("other-id").orEmpty()
    val x = path("x").orEmpty()
    return when {
        id.isNotBlank() -> Identifier.CustomerId(id)
        otherId.isNotBlank() -> Identifier.CompanyId(otherId, x)
        else -> Identifier.NoId
    }
}
d
Possibly related to this bug: https://github.com/http4k/http4k/issues/1311
👍 1
s
That was a regression. Fixed in 6.1.0.1
http4k 1
kodee happy 3
🙏 1