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

SerVB

03/28/2020, 7:12 AM
Hi! What's the right way to log all request and responce bodies on the server? Currently I do it like this but there are issues: 1. After
ApplicationReceivePipeline.Phases.Transform
there are data classes in my case, I think it's better to see raw untransformed strings. However, before this phase, there is a ByteReadChannel, so I can't get the bytes without spoiling all next interceptors. Is there a way to make an interceptor here that prints raw data? 2. The messages are divided. Is there a way to merge them? I guess there is no chance I can get the request body in the second interceptor out-of-box, so a possible scheme here can be, for example, don't log anything in the first interceptor but place some kind of attachment and catch it in the second interceptor...