vcr/vcr — pull request #321 by jbence (2013-09-16 20:50:36+00:00)
Title: Reset response body reader on excon error_call

According the test suite for excon (and @geemus), on an error any response_block associated with the request is not called. The proposed change resets the response body reader attribute to the NonStreamingResponseBodyReader on an error_call if the request had an associated response_block.

The use case here is recording an interaction with AWS that returns 400 when a 200 was expected. This happens, for example, in the fog gem, where a call to get the details on a load balancer returns 400 because the load balancer does not exist. The documented AWS behavior is to return 400 status with an XML document describing the issue. This XML document is what VCR needs to record.

The excon processing will not send the response body to vcr via the response_block, so in that case, vcr needs to read the response body directly.

This appears, after a bit of experimentation, to be the smallest change between excon and vcr that produces the desired behavior.