I am trying to get response headers in webview when I post some url to the server. I am using shouldInterceptRequest method.
@Override
public WebResourceResponse shouldInterceptRequest(final WebView view, final WebResourceRequest request) {
if(request.getUrl().toString().contains(SMConstant.INTERCEPTED_URL)){
if(interceptFlag==0){
((Activity) mContext).runOnUiThread(new Runnable(){
@Override
public void run() {
view.postUrl(request.getUrl().toString(), EncodingUtils.getBytes(postData, "UTF-8"));
}
});
interceptFlag++;
}
}
return super.shouldInterceptRequest(view, request);
}
This method return WebResourceResponse object. But I am not getting the way how to get the response headers out of it.
By default return super.shouldInterceptRequest(view, request);
returns null.
so , what should be done so that actual webview response should be captured.