How to get the body of the WebResourceRequest in android webView

WebResourceRequest is an interface that can’t read the request body, but you can use your own interface something like this repo dose.

https://github.com/KonstantinSchubert/request_data_webviewclient

webView.setWebViewClient(new WriteHandlingWebViewClient() {
   @Override
   public boolean shouldOverrideUrlLoading(WebView view, WriteHandlingWebResourceRequest request) {
        // works the same as WebViewClient.shouldOverrideUrlLoading, 
        // but you have request.getAjaxData() which gives you the 
        // request body
   }
});

Leave a Comment