In retrofit (using kotlin), if I don't know the ty...
# squarelibraries
c
In retrofit (using kotlin), if I don't know the type coming back, but I want to make the network call so that I can inspect the request/response in charles... wouldn't I do this?
Copy code
suspend fun getItem(): Response<Any>
Doesn't compile... and my google fu (im assuming someone has inquired about this before) is failing me.
j
Use Unit
Or Void
c
Doesn't matter which? i.e. no differences between the two?
j
None
💯 1
c
@jw having a convo over in #chucker (the network traffic inspector lib) and someone said this and I'm curious if it's true?
Retrofit does not read 
Response<Void>
  or 
Response<Unit>
 at all and just closes the response body once the response is received. Chucker observes the network traffic that happens between your client and the server
My issue with that lib is that if I return Response<Unit> then the response body doesn't show up in the inspector. Which is weird though because since Chucker acts as an interceptor, I would still expect it to work.
j
the response is still read. closing spends up to 100ms discarding the body before it simply abandons the connection
c
Thanks for the help.
I guess one last question...
Retrofit does read the response but does not read response body
Is that correct? Just trying to figure out why having a return of Response<Unit> does not populate the response body in the network interceptor.
j
It has no effect on the actual request or response