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

igor.wojda

01/07/2021, 12:47 PM
I have enabled
development = true
in the
application.conf
file and I can see stack-traces in the console. Now I wonder is there any way to print into console all requests and responses (including returned data like JSON and http codes) ?
d

Dragos Rachieru

01/07/2021, 1:07 PM
i

igor.wojda

01/07/2021, 1:59 PM
It’s kind of what I need: I have added
CallLogging
Copy code
install(CallLogging) {
        format { call -> call }
}
… but getting the desired output is not straight forward: 1. I need a way to have query parameters nicely formatted -
call.request.queryParameters
(
ApplicationCall
class) displays params as
io.ktor.server.netty.NettyApplicationRequest$queryParameters$1@143dccc7
string while within the
routing { get {
DSL printing parameters
call.parameters
(
ApplicationCallPipeline
class) would produce nicely formatted string
Parameters [phoneNumber=[123]]
2. I don’t see a way to retrieve values of POST parameters at all 3. I am not sure how to retrieve request and response body I would appreciate some help on this
Goal here is to have something like tis for every request and response:
Copy code
Request
- path
- parameters
- body

Response
- body
4 Views