I am developing an android app and using retrofit to send requests and get responses. Like this:
public interface Service {
@POST("/GetInfo")
InfoResponse getInfo(@Body InfoRequest request);
}
I want to know how much data it will be used when doing these requests.
I find if I set the LogLevel for retrofit, it could print out the size in log.
For request:
---> HTTP POST http://.... Content-Type: application/json; charset=UTF-8 Content-Length: 516 ---> END HTTP (522-byte body)
For response:
<--- HTTP 200 http://.... :HTTP/1.1 200 OK Content-Type: application/json <--- END HTTP (420394-byte body)
This 522-byte and 420394-byte information what I want. Is there any way to get it directly without getting the log and parsing it?
If I have to use this log in order to calculate the size, any good way to get the size from log and then show on android?
Thanks!