fiddler

通過fiddler 發送接口信息:
http://blog.csdn.net/java2013liu/article/details/53380381
rules--automatic breakpoint --before response
在下方輸入 bpafter myzaker.com,沒篩選到時,輸入go放行
request勾選inspectors,response區域勾選textView(Transformer選擇none)
一些其他的設置:
http://blog.chinaunix.net/uid-27105712-id-3738821.html
修改request
http://www.cnblogs.com/lauren1003/p/6224417.html
埋點的驗證方法
寫的埋點腳本,實用性很差,跟同事討論了以下怎么測試埋點。
最終解決方案是,用fiddler的js語句,識別出url為trace.do的request,然后截取actiontype字段,從數據庫中導出埋點的數據,把截取的字段遍歷一遍,輸出在log里面。
實現方案如下
1.寫方法,用來截取actionType的id
public static function selectActionType(str){
var i = str.indexOf("actionType");
var str1=str.substr(i+11);
var j = str1.indexOf("&");
if(j!=-1){
str1=str1.substr(0,j);
}
return(str1);
}
2.寫方法,用來把id,和數據庫中導出的數據做一個匹配對比
public static function choose(str){
var myList={"0202":"test","0203":"test1","0204":"test2"};
for(var id in myList){
if(id==str){
str=str+","+myList[id];
break;
}else{
str=str+",沒找到這個埋點";
break;
}
}
return(str);
}
3.寫onbeforerequest方法,在請求時,做一個判斷,如果url符合要求,就獲取body,然后輸出對比結果;
static function OnBeforeRequest(oSession: Session) {
if (oSession.uriContains("/pabys/common/trace.do")) {
//oSession["ui-color"] = "blue";
var request=oSession.GetRequestBodyAsString();
//var request1=oSession.GetRequestBodyEncoding();
var aType=selectActionType(request);
//FiddlerApplication.Log.LogFormat(request1);
FiddlerApplication.Log.LogFormat(choose(aType));
}
……
}
4.實現結果如下

