如何检查由WebViews发出的HTTP请求 [英] How to inspect HTTP requests made by WebViews
本文介绍了如何检查由WebViews发出的HTTP请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如你所知,有很多要求(图片,脚本,AJAX等)发送加载一个网页时。所以,我需要让所有的请求,并对其进行检查。
As you know, a lot of request (images, scripts, AJAX, etc.) are send when loading a single page. So I need to get all those request and inspect them.
所以在问题将是:我怎么能检查所做的HTTP请求时的的WebView 载入页面?
So the Question would be: How can I inspect the HTTP requests that are made when a WebView loads a page ?
我想:报头,方法,状态code,响应,饼干
I want: headers, method, status code, response, cookies.
现在,我有:
public void onLoadResource(WebView view, String url){
Log.d("my-tag", "onLoadResource = " + url );
}
但是,这只能说明我的网址。
But that only shows me the URL.
推荐答案
看这里: https://开头要点.github.com / kibotu / 32313b957cd01258cf67 你在哪里得到的HTTP标头的安卓> = 21
Look here: https://gist.github.com/kibotu/32313b957cd01258cf67 where you get the http headers at android >=21
这篇关于如何检查由WebViews发出的HTTP请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文