https://kotlinlang.org logo
#ktor
Title
# ktor
a

Arnau Miro

03/27/2021, 10:33 PM
Hi guys! Which is the best way to intercept request and response to print body on logs? I have something like this but event with DoubleReceive I get io.ktor.request.RequestAlreadyConsumedException
Copy code
environment.monitor.subscribe(Routing.RoutingCallStarted) { call: RoutingApplicationCall ->
    println("Route started: ${call.route}")
    runBlocking { println(call.receiveText()) }
}
r

rnett

03/28/2021, 1:05 AM
There's logging features for client and server, fyi. And a double receive one that I think would enable what you have.
a

Arnau Miro

03/28/2021, 11:29 AM
Thanks Ryan! I have used also the CallLogging but the problem is that even having DoubleReceive enabled it gives me RequestAlreadyConsumedException
r

rnett

03/28/2021, 8:17 PM
That seems like a bug then, as long as you're using one of the supported request types (which from the snippet it looks like you are).
h

hhariri

03/29/2021, 5:06 AM
@Arnau Miro which version of Ktor are you using?
a

Arnau Miro

03/29/2021, 8:44 AM
1.5.2
🙏 1
88 Views