spawlak
09/25/2019, 2:07 PMmapper.writeValue...
) and set it as a body for the request. Is there any nicer way to do this in integration tests and just provide and object that would be then later on automatically serialized by test framework??cy
09/25/2019, 3:45 PMcy
09/25/2019, 3:46 PMHttpClient(TestHttpClientEngine.config { app = this@withTestApplication }) {
install(JsonFeature) {
serializer = KotlinxSerializer()
}
}.use { client ->
val result = <http://client.post|client.post><String>() {
url("<http://localhost/>")
contentType(ContentType.Application.Json)
body = MyEntity(1, "test", emptyList())
}
assertTrue { result.startsWith("MyEntity(") }
}
cy
09/25/2019, 3:46 PM{ app = this@... }
cy
09/25/2019, 3:53 PMlocalhost
is just a placeholder, no actual networking is usedspawlak
09/25/2019, 4:21 PMmp
09/26/2019, 4:16 PMspawlak
09/30/2019, 4:53 PMspawlak
09/30/2019, 4:54 PMspawlak
09/30/2019, 4:54 PMspawlak
09/30/2019, 4:54 PMspawlak
09/30/2019, 4:54 PMspawlak
09/30/2019, 4:55 PM