Chucker not intercepting custom response returned by another interceptor in OkHttp.
aatifansari opened this issue · 1 comments
✍️ Describe the bug
I am using multiple interceptor with okhttp instance but when I am returning custom response from another interceptor the request is not being logged.
💣 Steps to reproduce
Okhttp okhttp = new OkHttp();
okhttp.addInterceptor(new ChuckerInterceptor(this))
okhttp.addInterceptor(CustomInterceptor)
.build();
CustomInterceptor cp = new CustomInterceptor(){
@OverRide
public okhttp3.Response intercept(Chain chain) throws IOException {
Request request = chain.request();
String url = request.toString();
if(url.contains(FILTER_REGULAR_EXPRESSION)){
// Response i want to return
return new Response();
}
return chain.proceed(request);
}
}
🔧 Expected behavior
Request details in not being logged in list.
okhttp.addInterceptor(new ChuckerInterceptor(this))
okhttp.addInterceptor(CustomInterceptor)
Order of interceptors is important on OkHTTP. I would suggest you first register your CustomIncerceptor
and then Chucker