bir*_*rdy 5 ajax android webview http-headers webviewclient
我已经重写public WebResourceResponse shouldInterceptRequest(WebView webView, String url)
,它应该根据Ajax
功能的请求返回自定义响应。但是看起来WebResourceResponse
只包含响应体。我如何传递像这样的HTTP响应:
HTTP/1.1 202
Cache-Control: no-cache
Custom-param: param
Run Code Online (Sandbox Code Playgroud)
给我WebView
?
从 Android API 21 开始,WebResourceResponse.html#setStatusCodeAndReasonPhrase()和WebResourceResponse.html#setResponseHeaders()方法可用。