title: How to get the body of the WebResourceRequest in android webView
body: <p>I need to modify the request header of the android webView request. So, I add the following code in the method <code>shouldInterceptRequest</code>.</p>
  <p>Here is my code:</p>
  <pre><code>@Override
  public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
      try {
          String mUrl = request.getUrl().toString();
          OkHttpClient httpClient = new OkHttpClient();
          Request mRequest = new Request.Builder()
                  .url(request.getUrl().toString())
                  .addHeader(&quot;token&quot;, UserHelper.getToken()) //add headers
                  .build();
          Response response = httpClient.newCall(mRequest).execute();
  
          return new WebResourceResponse(
              getMimeType(request.getUrl().toString()), // set content-type
              response.header(&quot;content-encoding&quot;, &quot;utf-8&quot;),
              response.body().byteStream()
          );
      } catch (Exception e) {
          return super.shouldInterceptRequest(view, request);
      }
      return super.shouldInterceptRequest(view, request);
  }
  </code></pre>
  <p>Actually, it works, all the requests carry the new header. However, because I construct the new request, the original request method/body was lost. I don't know how to keep the original method and body from the WebResourceRequest.</p>