title: Android WebView set custom header
body: <p>I'm already override shouldInterceptRequest(final WebView view, final WebResourceRequest request).When I got request from loadUrl,I want to add custom headers.what can I do to fix my code?</p>
  
  <pre><code>@SuppressLint("NewApi")
          @Override
          public WebResourceResponse shouldInterceptRequest(final WebView view, final WebResourceRequest request) {
              if (request != null &amp;&amp; request.getUrl() != null) {
                  String scheme = request.getUrl().getScheme().trim();
                  if (scheme.equalsIgnoreCase("http") || scheme.equalsIgnoreCase("https")) {
                      WiFiSingleton wiFiSingleton = new WiFiSingleton ();
                      request.getRequestHeaders().put("token", wiFiSingleton.getToken());
                      return super.shouldInterceptRequest(view, request);
                  }
              }
              return super.shouldInterceptRequest(view, request);
          }
  </code></pre>