very basic… but why this test code is not compiling on the `install` statement? ``` @Test fun...
l
very basic… but why this test code is not compiling on the
install
statement?
Copy code
@Test
    fun testOptimizeRouter() = testApplication {
        val client = createClient {
            install(ContentNegotiation) {
                json()
            }
        }
        // omitted
     }
Ktor 2.1.3 Kotlin 1.7.21 IDEA CE 2022.3 Beta (EAP)
2️⃣ 1
h
because
install
matches the client as well as the server plugin dsl
l
@hfhbd not sure if I followed this declaration is everywhere on Ktor's documentation and samples, what's is the point again that might be the problem?
h
install
is used in the client config dsl as well as in the server config dsl. Because you use
application {
and inside this scope, you call
client {
, there is a mismatch because both have an
install
function.
r
I think the problem is simpler and you try to install server
ContentNegotiation
plugin into client. Please check your imports.
👍 1
l
@Rustam Siniukov you nailed it… the import was pointing to the
server
plugin, additionally I had to added
ktor-client-content-negotiation
dependency to be able to use the client version of the plugin… a bit tricky tbh, but worked in the end.