Network interceptor connection() might be null
See original GitHub issueFor example, if looking up the connection after a request is completed, and it has both Connection: close
and an empty response body.
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
OkHttp interceptor keep returning null and crashing the app
I have an OkHttp client which uses my custom network interceptor in order to insert token into requests header. I ...
Read more >Android: Intercept on no internet connection | by Elye - Medium
So in this blog, I'll show how to setup no internet connection detection naturally in OkHttp, which only needs to be done once...
Read more >okhttp3.Interceptor$Chain.connection java code examples
Returns the connection the request will be executed on. This is only available in the chains of network interceptors; for application interceptors this...
Read more >Seamless Network State Monitoring With Retrofit + OkHttp
To monitor the state of the network we'll use an OkHttp Interceptor. An Interceptor will let us “intercept” the web request and perform...
Read more >Interceptors - OkHttp
Register an application interceptor by calling addInterceptor() on OkHttpClient. ... The network interceptor's Chain has a non-null Connection that can be ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I responded on the stetho issue, I believe that person is referring to the ApplicationInterceptorChain class. Returning null for connection() is deliberate. The wiki mentions connection() is available with network interceptors only. Let me know if I’m misunderstanding something.
Ah cool. Thanks!