You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
source.request(Long.MAX_VALUE) // Buffer the entire body.
I see this line still read entire body to buffer. so I think this will cause OutOfMemoryError if body is big enough. (not tested yet)
Can we change it to maxBodyLength? But I think this will bring another issue with gzip content.
The text was updated successfully, but these errors were encountered:
Thank you for the suggestion. I'll think about changing this, although, in fact, it might cause more issues with compressed content and displaying correct content length.
If your responses contain hundreds of megabytes of data then you should probably not log them at all.
@imcloud ANRs don't occur because of full memory. They occur because of long running operations on the main thread. Are you sure you're not running your request on the main thread?
Your case seems to be very specific and I'm not sure if it would be the best idea to add this feature for everyone. It might be best for you to just copy the code of CustomizableHttpLoggingInterceptor (it's just one class) and customize it even more to skip logging some request bodies for specific requests or skip logging request bodies when they have a certain content type.
customizable-okhttp-logging-interceptor/src/main/kotlin/com/bartoszwesolowski/okhttp3/logging/CustomizableHttpLoggingInterceptor.kt
Line 156 in 05f13c0
I see this line still read entire body to buffer. so I think this will cause OutOfMemoryError if body is big enough. (not tested yet)
Can we change it to
maxBodyLength
? But I think this will bring another issue with gzip content.The text was updated successfully, but these errors were encountered: