Sylvain Bécuwe
04/29/2024, 8:36 PMinstall(LogbookClient)
And which needs to read both request and response body ?
Currently it seems a little bit complicated as you can see in this sample:
https://github.com/grassehh/issues/blob/main/zalando-logbook-1822/src/test/kotlin/com/grassehh/logbook/LogbookClient.kt
The major issue is that for the response, it requires you to read request.content
which is an internal API.
But in general, the fact that you need to deal with ByteReadChannel, handle coroutines etc. makes a lot of boilerplate code.
It would be nice also to be able to use the new API for such use case.Mario Niebes
04/29/2024, 9:40 PMHttpClient().config {
install(Logging) {
logger = object : Logger {
override fun log(message: String) {
// do whatever. e.g.
KotlinLogging.logger("http.client").info { message }
}
}
level = LogLevel.ALL
}
}
Sylvain Bécuwe
04/29/2024, 9:55 PMAleksei Tirman [JB]
05/07/2024, 9:37 AMHttpResponse.content
you can use the HttpResponse.bodyAsChannel
method to get the response body as a channel. As I can see, the current implementation already exposes the plugin object which can be installed into the client. You can convert the current implementation to use the new plugin API by following the documentation.