betamaxpy / betamax

A VCR imitation designed only for python-requests.
https://betamax.readthedocs.io/en/latest/
Other
567 stars 62 forks source link

Always return a new Interaction Response when calling `as_response()` #99

Closed arhoyling closed 8 years ago

arhoyling commented 8 years ago

When streaming the response (e.g. using Response.raw.read()) the underlying HTTPResponse data stream is fully consumed. This means that subsequent requests will return an empty content.

Deserializing a new Response every time Interaction.as_response() is called allows us to use a fresh identical Response every time. It does not introduce a significant overhead compared to the previous cached version.

sigmavirus24 commented 8 years ago

I rebased this and merged it into master. Thanks @arhoyling !