yes. only 2xx responses contain bodies of that typ...
# squarelibraries
j
yes. only 2xx responses contain bodies of that type
k
gotcha
is there any way to do smart casting? eg
Copy code
if (response.isSuccessful)
?
j
sadly no
k
ah okay. Thanks!
c
isn't it possible with kotlin's contracts? (sorry for the necroposting :S)
k
I was actually just about to post this. Contracts are still experimental. Maybe it will be implemented once they're considered stable?
Reading about them now, it seems it would be impossible
We can only apply contracts on top-level functions with a body, i.e. we can't use them on fields and class functions.
unless
Response.body
were implemented as as an inlined extension function