Jonathan Lennox
05/23/2022, 7:52 PMTextContent
, so the test could inspect it to make sure it had the right content. With ktor 2, however, the request.body is an OutputStreamContent
- what's the best way for me to verify that its content is correct?hfhbd
05/23/2022, 8:03 PMresponse.bodyAsText()
Jonathan Lennox
05/23/2022, 8:03 PMhfhbd
05/23/2022, 8:04 PMJonathan Lennox
05/23/2022, 8:08 PMsuspend fun OutputStreamContent.asText(): String =
String(ByteChannel().also { writeTo(it) }.toByteArray(), Charsets.UTF_8)
works, but is there a cleaner way?hfhbd
05/23/2022, 8:09 PM.body.toByteReadPacket().readText()
instead, but don't know, which is better 😄Jonathan Lennox
05/23/2022, 8:12 PMbody
is OutputStreamContent
, so it seems better. Thanks!hfhbd
05/23/2022, 8:13 PMJonathan Lennox
05/23/2022, 8:14 PMhfhbd
05/23/2022, 8:14 PMJonathan Lennox
05/23/2022, 8:14 PM