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

编程入门 行业动态 更新时间:2024-10-24 04:34:29
本文介绍了如何使用Fiddler修改HTTP响应中的状态代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我需要测试一些我编写的客户端应用程序代码,以测试它对来自Web服务器的HTTP响应中返回的各种状态代码的处理。

I need to test some client application code I've written to test its' handling of various status codes returned in an HTTP response from a web server.

I安装了Fiddler 2(Web调试代理),我相信有一种方法可以使用这个应用程序修改响应,但我很难找到方法。这将是最方便的方式,因为它允许我保持客户端和服务器代码不被修改。

I have Fiddler 2 (Web Debugging Proxy) installed and I believe there's a way to modify responses using this application, but I'm struggling to find out how. This would be the most convenient way, as it would allow me to leave both client and server code unmodified.

任何人都可以协助,因为我想拦截HTTP响应从服务器发送到客户端并在到达客户端之前修改状态代码?

Can anyone assist as I'd like to intercept the HTTP response being sent from server to client and modify the status code before it reaches the client?

任何建议都将不胜感激。

Any advice would be much appreciated.

推荐答案

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

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:

  • 规则>自动断点>回复后
  • 在quickexec框中(黑色框中的黑框)底部)输入bpafter yourpage.svc。现在Fiddler将在对包含yourpage.svc的任何URL的所有请求之前停在断点处。键入bpafter,没有参数来清除断点。
  • 使用FiddlerScript以编程方式篡改响应。 FiddlerScript的最佳文档在官方网站上: www.fiddler2/Fiddler/dev /
  • Rules > Automatic Breakpoints > After Responses
  • 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.
  • Programmatically tamper with the response using FiddlerScript. The best documentation for FiddlerScript is on the official site: www.fiddler2/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:

  • 在绿色的Run to Completion按钮旁边(你点击发送回复)有一个下拉列表可以让你选择一些默认的响应类型。
  • 或者,在Headers检查器上,更改响应代码&顶部文本框中的消息。
  • 或者,单击原始检查器并弄乱原始响应以对其执行任意操作。同样是一个很好的方法来查看客户端在收到格式错误的响应时会做什么,您可能会意外地进行测试:)
  • 更多推荐

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

    本文发布于:2023-11-15 14:03:09,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1595092.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:如何使用   状态   代码   HTTP   Fiddler

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!