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

Add support for Typhoeus #66

Closed
bblimke opened this Issue Nov 18, 2010 · 7 comments

Comments

Projects
None yet
2 participants
Owner

bblimke commented Nov 18, 2010

No description provided.

Collaborator

myronmarston commented Nov 18, 2010

I just recently added Typhoeus support directly to VCR. Typhoeus provided all of the integration points with no monkeypatching needed. You can check out my Typhoeus adapter to get you started if you decide to do this.

Owner

bblimke commented Nov 18, 2010

Nice. Thank you Myron!

Owner

bblimke commented Nov 20, 2010

Unfortunately solution which uses Typhoeus internal stubbing only works for Typhoeus::Hydra so Typhoeus::Easy and Multi are not supported.

Collaborator

myronmarston commented Nov 20, 2010

Hey Bartosz,

You're correct. When I was working with David Balatero one of the typhoeus maintainers, to get VCR/Typhoeus integration to work, I asked him the same thing. Here's what he said:

Stubbing works for all requests that go through Hydra. This means everything but Typhoeus::Easy and Typhoeus::Multi will work. Using Typhoeus::Easy/Multi directly is not supported by us (the maintainers), and in general, is the Wrong Way To Do It.

I think this should be documented better, so I opened up an issue on the Typhoeus issue tracker.

You could of course monkey patch easy and multi to make them work, but I always view monkey patching as a solution of last resort. That's why I just went with the stubbing interface provided by Typhoeus for VCR.

Owner

bblimke commented Nov 20, 2010

I will have to monkeypatch anyway since WebMock stubs have more features than Typhoeus stubs so I can't just match using Typhoeus stubs. In addition webmock has own real connections control which also requires monkeypatching unless there will be before_real_request callback available in Hydra.

I first wrote an adapter for Hydra but then I realised that actually Hydra uses Easy and Multi behind the scenes. The obvious solution was to write WebMock adapter for Easy and Multi which will handle Hydra too. This solution would make WebMock completely independent from Typhoeus stubbing framework. (I actually already wrote Easy adapter)
Now I'm confused, because if Easy and Multi is not supported, then I can not rely on the interface as it can be changed (and I actually wasted time on writing Easy adapter)

Collaborator

myronmarston commented Nov 20, 2010

Rather than monkey patching Typhoeus, have you considered working with the Typhoeus maintainers to add the functionality you want to Typhoeus? It didn't have everything I needed, but I worked with them to add it.

Owner

bblimke commented Aug 9, 2011

Decided to abandon Typhoeus::Easy and Multi support for now. Typhoeus::Hydra is part of 1.7.0 release.

@bblimke bblimke closed this Aug 9, 2011

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