How can I get the number of actual bytes transferred with OkHttp3?

Viewed 96

OkHttp does a great job of transparently handling GZIP content encoding. When I call response.body().contentLength() I get the decoded size of the response.

How can I get the number of bytes actually transferred in the HTTP response?

Alternately, getting the value from the original Content-Length header would do.

I am trying to keep track of how many bytes I have downloaded over a metered connection.

1 Answers
Related