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

tomreay

11/07/2018, 5:38 PM
Following up on this - I'm trying to get this to work, the example kindly given seems to be for ktor-client, on the server side
proceed
and
proceedWith
both take
Unit
. I'm trying to read the request body in to use in request signing as part of an authorisation flow - I wonder if there is a better way of accomplishing this? (me and @twwork together - fyi)
v

vonox7

11/07/2018, 6:19 PM
you can just read at some point the whole text and store it in
call.attributes
. From there you can read it multiple times. Don’t forget to remove the String again if you keep for a longer time a reference to
call
but don’t use the content, so the JVM can free it sooner.
t

tomreay

11/07/2018, 9:02 PM
Thanks, something like that was the approach I was thinking but wanted to try and keep the resource methods ‘Ktor native’ and keep using the receive functions. I’m guessing garbage collection is the reason the body isn’t cached already to allow receive to be called multiple times