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

andrew

04/28/2019, 3:25 PM
with ktor, are we able to access the response body at all if we use a serialized class as the response type?
🚫 1
j

Jens Baitinger

04/28/2019, 6:06 PM
I hope you dont use java serialisation (which is a security problem)
d

darkmoon_uk

04/29/2019, 4:15 AM
serialized with a small 's'. 🙂
e

e5l

04/29/2019, 4:50 AM
You could get response first:
Copy code
val response = client.get<HttpResponse>(...)
and then receive from it:
Copy code
response.receive<MyData>()
☝️ 2
👍 2
a

andrew

04/30/2019, 12:55 AM
Thank you, will try it, although, does Ktor throw on any error?
e

e5l

05/01/2019, 7:51 AM
It can, depends on your case.
a

andrew

05/01/2019, 11:17 AM
Http errors it will throw on, yes?
If I wanted to handle those on my own, how would I do it?
3 Views