typhoeus/typhoeus — pull request #275 by ryankinderman (2013-02-24 01:18:11+00:00)
Title: Adding support for lazy construction of responses from stubbed requests

See new example doc entries on Typhoeus::Expectation for how this can be used.

Note:
* With the introduction of deferred response construction, the creation of a response for a request stub should be able to make assumptions about the request insofar as it matches the stub. For example, if the stub specifies that the request method is a GET, then the block that constructs the response should be able to assume that it's getting called for a GET request.
* To reduce the possibility that a response construction block is called with an unmatching request, I've replaced Typhoeus::Expectation.find_by with .response_for, to provide the *::Stubbable subclasses with a single method to call to obtain a stubbed response, if there are any that match the request. This is in an effort to emphasize that an expectation's response is based on the corresponding request matching the stub specification.