以下方法參考 fiddler官方文檔:http://docs.telerik.com/fiddler/KnowledgeBase/FiddlerScript/ModifyRequestOrResponse
一、標記 response 中指定字符串
1、在OnBeforeResponse 前添加 開關
public static RulesOption("標記返回值指定string")
var m_showMarkString: boolean = false;
添加位置示意:

2、在 OnBeforeResponse 內添加以下代碼並保存js
//替換response中指定string,引號需轉義
//oSession.HostnameIs("www.baidu.com")中,www.baidu.com替換為指定域名
//ExistsAndContains("Content-Type","application/json") 根據Response的header修改Content-Type的值
if ( m_showMarkString && oSession.HostnameIs("www.baidu.com") && oSession.oResponse.headers.ExistsAndContains("Content-Type","application/json")){
//以decode格式解碼
oSession.utilDecodeResponse();
//需要標記的字符串
var oFindStrings = new Array( "hd.zhe800.com","z2","z3","z11","v3\/deal\/all");
// For each target string, check the response to see if it's present.
var iEach=0;
oSession["ui-customcolumn"]=String.Empty;
for (iEach; iEach<oFindStrings.length; iEach++){
if (oSession.utilFindInResponse(oFindStrings[iEach], false)>0 ) {
//標記顏色
oSession["ui-color"]="#EE00EE";
//加粗
oSession["ui-bold"]="true";
//在custom標識response中有的關鍵字
oSession["ui-customcolumn"] += oFindStrings[iEach]+"; ";
}
}
}
添加位置示意圖:

二、替換 response 中指定字符串
1、在OnBeforeResponse 前添加 開關
public static RulesOption("替換返回值指定string")
var m_showReplaceString: boolean = false;
添加位置示意:

2、在 OnBeforeResponse 內添加以下代碼並保存js
//替換response中指定string,引號需轉義
//oSession.HostnameIs("www.baidu.com")中,www.baidu.com替換為指定域名
//ExistsAndContains("Content-Type","application/json") 根據Response的header修改Content-Type的值
if(m_showReplaceString && oSession.HostnameIs("www.baidu.com") && oSession.oResponse.headers.ExistsAndContains("Content-Type","application/json")){
//以decode格式解碼
oSession.utilDecodeResponse();
//替換前字符串
var oReplaceStrings = new Array( "\"state\":2","沖牙器1");
//替換后字符串(一一對應)
var oNewStings = new Array("\"state\":3","----啊沖牙器-----");
var iEach=0;
oSession["ui-customcolumn"]=String.Empty;
for (iEach; iEach<oReplaceStrings.length; iEach++){
// if true
if (oSession.utilReplaceInResponse(oReplaceStrings[iEach], oNewStings[iEach])){
//標記顏色
oSession["ui-color"]="#B03060";
//加粗
oSession["ui-bold"]="true";
//在custom標識response中被替換的字符串
oSession["ui-customcolumn"] += oReplaceStrings[iEach]+"; ";
}
}
}
添加位置示意圖:

三、實際使用
1、注意更換 域名、請求Content-Type、和對應 字符串
2、點擊右上角Save Script 才能保存成功
3、需要在rules中勾選啟用功能

實際使用效果:
使用效果如下,標記成功 或者 替換成功的url被會標記上顏色:

