What I'm attempting to do... handle custom HttpClient creation at the class level so that each test case need not create it. I have that working using a lateinit var, but was hoping the set up could be done and passed in via the testApplicationWrapper.
BryanT
04/17/2023, 1:40 PM
Copy code
private fun testApplicationWrapper2(testBlock: suspend ApplicationTestBuilder.(HttpClient) -> Unit) {
testApplication {
application {
configureRouting()
configureSerialization()
}
val client: HttpClient = createClient {
install(ContentNegotiation) {
json()
}
}
testBlock(client)
// usage found at <https://youtrack.jetbrains.com/issue/KTOR-4773>
}
}
a
Aleksei Tirman [JB]
04/18/2023, 9:02 AM
So has the
testApplicationWrapper2
method solved your problem?
b
BryanT
04/18/2023, 2:25 PM
Not for modifying the httpclient, that seems to be getting instantiated every time application test builder is called.