Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

httpclient support #6

Open
nbibler opened this Issue Oct 9, 2009 · 5 comments

Comments

4 participants

nbibler commented Oct 9, 2009

The soap4r gem currently uses httpclient gem which is not currently disabled when used with fakeweb (allow_net_connect = false).

It looks as though some work has been done at http://github.com/dkubb/fakeweb/commit/430bdc3cbed18d38f8a2391053c26e9e2262d671 although it is now a bit out of date.

nbibler commented Oct 9, 2009

So, I put together my own patch which adds this support - however - it's certainly not for mainline use as it is specific to httpclient + soap4r at the moment: http://gist.github.com/206226

However, it raised the interesting idea of abstracting the generated Net::HTTPResponse object to fit other libraries. In this case, I had to extend the response to carry status and content methods. It may be more useful to have a custom response object come back through FakeWeb.response_for, in most cases the current Net::HTTP-like object, but for httpclient, for instance, a slightly modified version. If that were available, I wouldn't have had to monkey with Net::HTTPHeader and HTTPClient in this patch.

Just a thought.

Owner

chrisk commented Nov 15, 2009

Note to self, httpclient is now on github. http://github.com/nahi/httpclient

woahdae commented Dec 25, 2009

implemented the patch in a branch on my fork:

http://github.com/woahdae/fakeweb/commit/a45da6465ec12de5ccf6976e9245fcac8476e07f

working in tests relying on soap4r

woahdae commented Dec 25, 2009

(would have sent a pull request, but didn't want to write tests and don't know how to make it generic)

Hey guys, I just runned into the same issue. I need to mock soap4r gem and it uses httpclient. I found this thread, that points to a fork which has the specific changes to fake httpclient, but it seems a bit older (January 05, 2009)..

http://groups.google.com/group/fakeweb-users/browse_thread/thread/7893b121c7c2414f/7309c3b6d7a5fe9c

Do you guys have any news about it?
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment