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

fabian

02/26/2019, 9:12 PM
hi, does somebody mind pointing me at the right docs or method for how to access the original request (POST) body when a
ContentConverter
like the
JacksonConverter
is installed?
s

Sergey Bondari

02/26/2019, 9:41 PM
in your route you can do something like
Copy code
post("/foo") {
    call.receiveStream().use {
      // raw bytes from input body
    }
   // or
   call.receiveChannel() // will give you a ByteReadChannel primitive for the lowest level reading routine. 
}
there are many flavors of receive. When you have JSON transformer, you can do
call.receive<Foo>()
and it will attempt to deserialize payload into a
Foo
class instance
f

fabian

02/26/2019, 10:53 PM
thank you, I will mess around with that 🙂