当前位置: 动力学知识库 > 问答 > 编程问答 >

unit testing - Is there a web service that spits out the entire request that was sent?

问题描述:

I apologize if this isn't "programming" worthy. I'm wondering if a service exists that when the HTTP service is pinged, it echos back the exact same request you made as the response.

The reason I want this is I want to UnitTest a class I made to build requests and send them over a socket. I realize I could just do a Mock object of some sort, but I think that involves more complexity than just making sure the request being sent was properly built.

Ideally, the web service would send the content back as proper HTTP 1.1 with the request info I sent in the body of the response.

Thanks!

Kyle

-- edit --

Just a quick reference to the solution. Point your browser to: http://scooterlabs.com/echo.json or http://scooterlabs.com/echo.xml

网友答案:

This guy seemed to have the same problem as you web service echo test
Refers to some links you might be interested in

网友答案:

I guess there are some uses for a simple echo, but in any kind of a realistic interaction it's going to be pretty hard to isolate just the piece you are trying to test.

A more general approach would be to use a local proxy server, stands as the man in the middle between you and all remote sites, and can log urls, responses, content and so on.

If you're developing the server side as well as the client, you definitely ought to run a local mirror of the server site.

分享给朋友:
您可能感兴趣的文章:
随机阅读: