https://kotlinlang.org logo
Title
v

Vivek Modi

04/20/2022, 2:45 PM
Hey guys, I used
@Body
in retrofit. what is alternative in ktor?
m

Mark Malik

04/20/2022, 3:20 PM
Did you tried retrieving it in the routing handler ? You can use the ContentNegotiation plugin to deserialize the payload to any class definition. https://ktor.io/docs/requests.html#body_contents
v

Vivek Modi

04/20/2022, 3:45 PM
I need in ktor client
your provide link is for body contents in ktor server
I am not using routing
m

Mark Malik

04/20/2022, 3:52 PM
ok, so you need to pass the payload as body when creating the request. This is an example:
client.get("/") {
                    setBody(Objects)
     }
sorry for the formatting
v

Vivek Modi

04/20/2022, 3:53 PM
great thanks a million
👍 1