How to inspect HTTP requests made by WebViews

android, android-webview, httprequest

Solution

The best you can get in your app is the `WebViewClient.shouldInterceptRequest` method, but that only has the URL. You currently can't get any of the things you've listed.

For debugging you can use Chrome DevTools if you're using Android 4.4.

Problem

As you know, a lot of request (images, scripts, AJAX, etc.) are send when loading a single page. So I need to get all those request and inspect them. So the question would be: How can I inspect the HTTP requests that are made when a WebView loads a page ? I want: headers, method, status code, response, cookies. Right now, I have: ``` public void onLoadResource(WebView view, String url){ Log.d("my-tag", "onLoadResource = " + url ); } ``` But that only shows me the URL.

Original source