Arnau Miro
06/18/2024, 10:59 AMinstall(ContentNegotiation) {
json(Json {
prettyPrint = true
isLenient = true
ignoreUnknownKeys = true
}, contentType = ContentType.Application.Json)
}
But client is responding that one incoming param is not on the serialized data class and I should add ignoreUnknownKeys = true to Json{}, but I already have itAleksei Tirman [JB]
06/18/2024, 12:47 PMArnau Miro
06/18/2024, 1:34 PMArnau Miro
06/18/2024, 1:35 PM@Serializable
data class Test(val singleParam: String, val otherParam: String)
get("/test") {
<http://call.application.log.info|call.application.log.info>("Test starts")
<http://call.application.log.info|call.application.log.info>("Test ends")
call.respond(HttpStatusCode.Accepted, Test("test", "test"))
}
Arnau Miro
06/18/2024, 1:35 PM@Test
fun eventTest() = myTestApplication {
val response = client.get("$PATH/test") {
header(HttpHeaders.ContentType, ContentType.Application.Json.toString())
}
Json.decodeFromString<TestModel>(response.bodyAsText())
}
Arnau Miro
06/18/2024, 1:37 PMAleksei Tirman [JB]
06/18/2024, 1:41 PMTestModel
class?Arnau Miro
06/18/2024, 1:55 PMArnau Miro
06/18/2024, 1:56 PM@Serializable
data class TestModel(val singleParam: String)
AdamW
06/18/2024, 2:01 PMJson
instance there in your test, which does not have any configuration? What is the error exactly?Arnau Miro
06/18/2024, 2:02 PMArnau Miro
06/18/2024, 2:03 PMArnau Miro
06/18/2024, 3:00 PM