在FiddlerScript中工作,我在OnBeforeResponse方法上进行了一些更改,这些方法曾经在不同的机器上工作(现在已经很久了)但现在不适合我。 我把它归结为以下基本示例。
在fiddler沙盒页面上,我试图用每个项目的 URL替换每个项目的单词: http : //webdbg.com/sandbox/shop/
Fiddler脚本文件从原来修改为有两个新行。 1根据我见过的所有例子以及曾经为我工作的内容解码会话,1代替响应。
static function OnBeforeResponse(oSession: Session) { oSession.utilDecodeResponse(); //Added this. oSession.utilReplaceInResponse("per item", "per item"); //Added this if (m_Hide304s && oSession.responseCode == 304) { oSession["ui-hide"] = "true"; } }保存上面的fiddlerscript文件并刷新页面后,我没有在浏览器中看到替换显示。 如果我查看Fiddler检查员,我会看到替换。 这意味着OnBeforeResponse确实在某个时刻被调用,而utilReplaceInResponse也在执行。
更奇怪的是,如果我在所有响应(Fiddler - > Rules - > Automatic Breakpoints - > After Responses)之后放置断点并刷新页面,响应会按预期点击断点,然后单击Run to Completion并且浏览器确实显示替换。 所以:没有断点,页面不会在呈现的页面中显示替换。 通过断点并简单地运行完成,页面确实显示了替换。
为什么页面显示浏览器中的更改,即使它在Fiddler检查器中显示,或者我设置了断点?
。
解决方案如果在主工具栏中选择了Stream选项 - 取消选择它并按预期工作。
。
环境:Fiddler v2.4.5.3 - 64位AMD64,VM:114.00mb,WS:132.00mb .NET 2.0.50727.5472 WinNT 6.1.7601 SP1
见过IE9和Chrome31
Working in FiddlerScript, I've got some changes being made in the OnBeforeResponse method that used to work on a different machine (now long gone) but aren't working for me now. I've boiled it down to the following basic example.
On the fiddler sandbox page, I'm trying to replace the word per item with the words per item URL: http://webdbg.com/sandbox/shop/
Fiddler script file modified from the original to have two new lines. 1 to decode the session and 1 to replace in the response as per all examples I've seen and what used to work for me.
static function OnBeforeResponse(oSession: Session) { oSession.utilDecodeResponse(); //Added this. oSession.utilReplaceInResponse("per item", "per item"); //Added this if (m_Hide304s && oSession.responseCode == 304) { oSession["ui-hide"] = "true"; } }After saving the above fiddlerscript file and refreshing the page, I'm not seeing the replaces show in the browser. If I look in the Fiddler inspector, I am seeing the replaces. This means that the OnBeforeResponse is indeed being called at some point and the utilReplaceInResponse is also executing.
Additional oddity, if I put breakpoints after all responses (Fiddler -> Rules -> Automatic Breakpoints -> After Responses) and refresh the page, the response hits the breakpoint as expected and I click Run to Completion and the browser does show the replacement. So: No breakpoint, page doesn't show replacements in the rendered page. With breakpoint and simply running to completion, the page does show the replacements.
Why isn't the page showing the changes in the browser even though it shows them in the Fiddler inspector, or if I have a breakpoint set?
.
SOLUTION Had the Stream option selected in the main toolbar - deselected that and it works as expected.
.
Environment: Fiddler v2.4.5.3 - 64-bit AMD64, VM: 114.00mb, WS: 132.00mb .NET 2.0.50727.5472 WinNT 6.1.7601 SP1
Seen on both IE9 and Chrome31
最满意答案
解决了自己。
我在工具栏中启用了Stream选项。 (Doh!)取消选择,OnBeforeResponse中的替换按预期工作。
Solved myself.
I had the Stream option enabled in the toolbar. (Doh!) De-select that and the replacement in the OnBeforeResponse works as expected.
更多推荐
发布评论