其他分享
首页 > 其他分享> > fiddler的mock数据与二次开发示例

fiddler的mock数据与二次开发示例

作者:互联网

fiddler的使用记录

fiddler了解

实例使用

fiddler二次开发应用

//第一处:找到开头的代码注释后新增后面代码:
 /*
    BindPref("fiddlerscript.ephemeral.bpRequestURI")
    public static var bpRequestURI:String = null; # zch改过第1处
    */
   // 设置数组的长度为10 10个阻塞的命令,内容为空格,和bpu命令用空格分割保持一致    
    BindPref("fiddlerscript.ephemeral.bpRequestURI")
    //数组的长度10,10个阻塞的命令,内容为空格,和bpu命令用空格分割保持一致
    public static var bpRequestURIs:String[] = [" "," "," "," "," "," "," "," "," "," "];
//第二处:找到开头的代码注释后新增后面代码:
        /*
        case "bpu":
            if (sParams.Length<2) {bpRequestURI=null; FiddlerObject.StatusText="RequestURI breakpoint cleared"; return false;}
            bpRequestURI = sParams[1]; 
            FiddlerObject.StatusText="RequestURI breakpoint for "+sParams[1];
            return true;
            zch改过这里 第2处 */
        case "bpu":
            var len1 = sParams.Length ;
            var len2 = bpRequestURIs.Length;
            //每次赋值之前先恢复原始值
            for(var i = 0; i< len2; i++){
                bpRequestURIs[i]=" ";
            }
            if (len1 < 2) {FiddlerObject.StatusText="RequestURI breakpoint cleared"; return false;}
            var text = "";
            for(var i = 1; i < len1; i++){
                bpRequestURIs[i-1] = sParams[i];
                text += sParams[i] +" ";
            }
            FiddlerObject.StatusText="RequestURI breakpoint for " + text;
            return true;
//第三处:找到开头的代码注释后新增后面代码:
 /*if ((null!=bpRequestURI) && oSession.uriContains(bpRequestURI)) {
            oSession["x-breakrequest"]="uri";
        }
        zch改过这里(第三处)*/
        var len = bpRequestURIs.Length;
        for(var i = 0; i< len; i++){
            if(bpRequestURIs[i]!=null && bpRequestURIs[i]!= " "&& oSession.uriContains(bpRequestURIs[i]) ){
                oSession["x-breakrequest"]="uri";
            }
        }

标签:fiddler,示例,bpRequestURIs,bpRequestURI,bpu,二次开发,拦截,断点
来源: https://www.cnblogs.com/morethansea/p/15563347.html