是否可以捕获来自 ActionScript (Flex) 模块的传出 http 调用?
我正在尝试为我们正在开发的一些 ActionScript 代码(Flex 3.5)开发一个测试框架。发生的情况是这样的:
作为 Web Analytics 功能的一部分,我们调用类中的 track 方法,并在调用过程中提供相关信息。该方法在库(SWC)中提供,我们无法访问代码。
最终,track 方法将传出的 http 请求发送到跟踪服务器。我们可以在 HttpFox 中很高兴地看到这一点。
我希望能够捕获此传出请求并在我的测试类中询问它,从而使我们能够a)以更独立的方式运行测试,b)以编程方式确定正在跟踪正确的信息。
I'm trying to develop a test framework for some ActionScript code we're developing (Flex 3.5). What's happening is this:
As part of a Web Analytics function we are calling a track method in a class, providing the relevant information as part of the call. This method is provided in a library (SWC), and we have no access to the code.
Ultimately the track method sends an outgoing http request to the tracking server. We can see this quite happily in HttpFox.
I was hoping to be able to capture this outgoing request and interrogate it in my test class, allowing us to a) run tests in a more standalone fashion, and b) programmatically determine that the correct information is being tracked.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
没问题,只需运行此开发人员工具即可显示离开您计算机的所有请求。
http://www.charlesproxy.com/
No problem just run this developer tool that displays all requests leaving your machine.
http://www.charlesproxy.com/
除非您要使用嗅探工具(这可能很难用于程序化评估),否则我建议使用代理来传递您的请求。您可以让 track 方法将请求发送到代理服务器上的 php 脚本,让它评估请求内容,然后将其转发到实际的跟踪服务器。我想在跟踪系统上,您不需要担心响应,因此实施起来应该不会太难。
Unless you're going to use a sniffing tool, which probably would be hard to use for a programmatic evaluation, I would recommend using a proxy to channel your request. You could let the track method send the request to a php script on the proxy server, have it evaluate the request content, and then forward it to the actual tracking server. I suppose on a tracking system, you won't need to worry about the response, so it shouldn't be too hard to implement.
您可以在本地主机(或任何实际的本地主机)上运行 Web 服务器,只需确保代码尝试访问的 DNS 条目指向您正在运行的服务器。
You could run a web server on a localhost (or any really) and just make sure the DNS entry the code is trying to access points to the server you are running.