Hi guys, I use an Client to make REST calls and I ...
# ktor
l
Hi guys, I use an Client to make REST calls and I would like to store a value between the request and the response (the goal is to log the elapsed time). I don't really know where I can store this value so that it's available later from a
ResponseObserver
. Do you have any clue ?
e
You could intercept
request
and
response
pipeline in
State
phase. And store value in attributes
☝️ 2
l
Ah, that's more or less what I ended up doing : I read the docs a bit more thoroughly and found out the piece about attributes. So in my logging feature (that intercepts at Before phase, I guess it would be better to do it at State phase as you said) I put stuff in
call.request.attributes
. Thanks for the hint !
👍 1