Starting from Android API 21 WebResourceResponse.html#setStatusCodeAndReasonPhrase() and WebResourceResponse.html#setResponseHeaders() methods are available.
How to return Http error response from webViewClient.shouldInterceptRequest()?
-
20-09-2022 - |
Question
I've override public WebResourceResponse shouldInterceptRequest(WebView webView, String url)
and it should return custom response on request from Ajax
function. But looks like WebResourceResponse
contains only response body. How can I pass HTTP response like this one :
HTTP/1.1 202
Cache-Control: no-cache
Custom-param: param
to my WebView
?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow