parroty / exvcr

HTTP request/response recording library for elixir, inspired by VCR.
MIT License
722 stars 132 forks source link

Support binary responses #121

Closed frekw closed 6 years ago

frekw commented 7 years ago

Hi!

I ran into some issues when using VCR to record interactions with a MessagePack based backend since JSON can only encode binary data.

I rewrote the saving and loading parts to base64-encode the data, if it is deemed to be binary (i.e isn't a valid string).

Since the gzip handling is a subset of binary data, I got rid of the special casing for gzipped data as well. The downside of this is that old cassettes containing gzipped data will need to be re-recorded (we could of course keep the special casing of gzipped data) and gzipped endpoints won't be easily inspectable via the json cassettes.

I think that's a fair tradeoff in order to get the recordings as close as possible to the actual API.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.6%) to 93.512% when pulling 73df34d58e24ffb60d558227f6fd100766fd4f61 on frekw:master into 0f8aeeb19e5164917302ce257a2a1c324e02ff3b on parroty:master.

brandonparsons commented 6 years ago

Thanks for this! @parroty any chance you can cut a release with this in it?

pedrofranceschi commented 6 years ago

+1

parroty commented 6 years ago

Thanks, and very sorry being late to take action.

frekw commented 6 years ago

No problem. Thanks! 👍