In my api response there is field called `isSucces...
# android
k
In my api response there is field called
isSuccess
to see if
post
or any other request is success or not. so thats why it return result OK(200) even if i have sent invalid values, so in above extension function on
Response
can i check
isSuccess
variable from original
json
? Note: this extension function is called on
Response
from retrofit
l
You have to check if the
Response.body
you’re receiving is of the type you’re looking for:
YourResponse
and then perform the check 🙂
Something like:
if (response.body() is YourResponse && response.body().isSuccess)
Be aware though that calling
response.body()
will consume it, so better save it in a var