fiddler script设置
设置fiddler script步骤:rules>customize rules...
1.设置弱网:
ctrl+f 搜索delay
设置完成勾选rules>performance>simulate modem speeds,注意此选项退出fiddler后需重新勾选才生效
statistics可以查看请求开始到结束所用时间
2.设置显示时间
function BeginRequestTime(oS: Session)
{
if (oS.Timers != null)
{
return oS.Timers.ClientBeginRequest.ToString();
}
return String.Empty;
}
public static BindUIColumn("Time Taken")
function CalcTimingCol(oS: Session){
var sResult = String.Empty;
if ((oS.Timers.ServerDoneResponse > oS.Timers.ClientDoneRequest))
{
sResult = (oS.Timers.ServerDoneResponse - oS.Timers.ClientDoneRequest).ToString();
}
return sResult;
}
另外设置代码:
class Handlers { // 显示每行请求的发起时间:时分秒毫秒 public static BindUIColumn("BeginTime", 80) function BeginTimingCol(oS: Session){ return oS.Timers.ClientDoneRequest.ToString("HH:mm:ss.fff"); } // 显示每行请求的响应时间:时分秒毫秒 public static BindUIColumn("EndTime", 80) function EndTimingCol(oS: Session){ return oS.Timers.ServerDoneResponse.ToString("HH:mm:ss.fff"); } // 显示每行请求的服务端耗时时间 public static BindUIColumn("Time Taken", 80) function CalcTimingCol(oS: Session){ var sResult = "0"; if ((oS.Timers.ServerDoneResponse > oS.Timers.ClientDoneRequest)) { sResult = (oS.Timers.ServerDoneResponse - oS.Timers.ClientDoneRequest).TotalMilliseconds.ToString("N0"); } return sResult + "ms"; } // 显示每行请求的服务器IP public static BindUIColumn("ServerIP", 80) function xxxdColumn(oS: Session): String { return oS["X-HostIP"]; } // 显示每行请求的METHOD public static BindUIColumn("Method", 40) function FillMethodColumn(oS: Session): String { return oS.RequestMethod; }
3.设置显示IP
FiddlerObject.UI.lvSessions.AddBoundColumn("ServerIP",120,"X-HostIP");
以上设置完成后保存代码,并退出fiddler重启