且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用Fiddler修改HTTP响应中的状态代码?

更新时间:2022-05-04 05:18:38

好的,所以我假设你已经能够监控你的客户端/服务器流量了。您要做的是在响应上设置一个断点,然后在将其发送到客户端之前摆弄它。

Ok, so I assume that you're already able to monitor your client/server traffic. What you want to do is set a breakpoint on the response then fiddle with it before sending it on to the client.

以下是几种不同的方法:

Here are a couple of different ways to do that:


  1. 规则>自动断点>回复后

  2. 在quickexec框中(黑色框中的黑框)底部)输入bpafter yourpage.svc。现在Fiddler将在对包含yourpage.svc的任何URL的所有请求之前停在断点处。键入bpafter,没有参数来清除断点。

  3. 使用FiddlerScript以编程方式篡改响应。 FiddlerScript的***文档在官方网站上: http://www.fiddler2.com/Fiddler/dev /

  1. Rules > Automatic Breakpoints > After Responses
  2. In the quickexec box (the black box at the bottom) type "bpafter yourpage.svc". Now Fiddler will stop at a breakpoint before all requests to any URL that contains "yourpage.svc". Type "bpafter" with no parameters to clear the breakpoint.
  3. Programmatically tamper with the response using FiddlerScript. The best documentation for FiddlerScript is on the official site: http://www.fiddler2.com/Fiddler/dev/

一旦你在断点处停止了响应,只需双击它就可以在检查员中打开它。你现在有几个选择:

Once you've got a response stopped at the breakpoint, just double click it to open it in the inspectors. You've got a couple of options now:


  1. 在绿色的Run to Completion按钮旁边(你点击发送回复)有一个下拉列表可以让你选择一些默认的响应类型。

  2. 或者,在Headers检查器上,更改响应代码&顶部文本框中的消息。

  3. 或者,单击原始检查器并弄乱原始响应以对其执行任意操作。同样是一个很好的方法来查看客户端在收到格式错误的响应时会做什么,您可能会意外地进行测试:)