chucker: Chucker 3.1.2 re-writing the Server Response; throws IOException when used as a networkInterceptor

✍️ Describe the bug

After updating to 3.1.2 (from 3.0.1) every request fails with an IOException:

java.io.IOException: ID1ID2: actual 0x00007b22 != expected 0x00001f8b
System.err:     at okio.GzipSource.checkEqual(GzipSource.java:205)
System.err:     at okio.GzipSource.consumeHeader(GzipSource.java:120)
System.err:     at okio.GzipSource.read(GzipSource.java:73)
System.err:     at okio.RealBufferedSource.read(RealBufferedSource.java:51)
System.err:     at okio.ForwardingSource.read(ForwardingSource.java:35)
System.err:     at retrofit2.OkHttpCall$ExceptionCatchingResponseBody$1.read(OkHttpCall.java:288)
System.err:     at okio.RealBufferedSource.select(RealBufferedSource.java:100)

Chucker 3.0.1 returned the original Response. 3.1.x seems to process the response and returns this “processed Response” (see here).

I see the need of processing the Response and doing stuff with it. But the Interceptor has to return the original response at the end, since Chucker is only some kind of debugging ouput, which should not change the Request/Response in any way.

💣 Steps to reproduce

  • Add ChuckerInterceptor as a networkInterceptor
  • I think the Request has to be gzipped

🔧 Expected behavior

  • Chucker should not alter the Server Response

📱 Tech info

Chucker version: 3.1.2 OkHttp version: 3.14.6

📄 Additional context

This only happens when the ChuckerInterceptor is added as a networkInterceptor. The Notification shows the correct Request with the Response.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 17 (9 by maintainers)

Most upvoted comments

Yes, we should include it into 3.2.0. As for ETA - I would say that I would love to see support of GraphQL to release the new version. It seems that I need to dive into that old PR myself, since there is completely no progress or movement for quite a long time.

Ok, I pushed one small change to the PR to not rewrite the response at all.

The idea sounds nice. If you would be able to send a draft PR for this approach we could brainstorm on this (or you can join the #chucker channel on Kotlinlang and we can discuss over there)

I’ll gladly make some PoC when I find more time as this is rather big change.