kevin1024 / vcrpy

Automatically mock your HTTP interactions to simplify and speed up testing
MIT License
2.69k stars 387 forks source link

Enable a VCR TransportAdapter plugin to HTTPie #426

Open bobh66 opened 5 years ago

bobh66 commented 5 years ago

I'm working on a VCRpy TransportAdapter plugin for HTTPie (https://httpie.org/) which will allow users to record REST API interactions using the http command line client.

The work is basically done but there is one problem. HTTPie defaults to displaying the response body and headers, including the HTTP version information from the raw response.

Since VCRpy does not save the HTTP version from the raw response (it explicitly sets version to None in the VCRHTTPResponse class), when http tries to format the response headers it raises a KeyError exception. The VCRpy portion of the plugin works fine, and it you run http with the "-b" option to exclude the header output, there is no problem at all.

I'd like to submit a PR to VCRpy to add the HTTP version in the stored record to enable HTTPie to format the header output. As far as I can tell it's a two-line change, but it does change the stored record format.

Any thoughts? The VCR TransportAdapter plugin to HTTPie is really useful to record API interactions manually, so it would be nice to be able to release it without the header output issue.

Thanks,

Bob

neozenith commented 4 years ago

A lot of changes have happened to VCRpy since this ticket was opened. As this ticket has become stale, would you mind closing it if it is no longer needed / relevant?

If I haven't heard anything in a week I'll mark it as closed as we have a lot of old tickets that need to be groomed to make it easier to see what is still relevant.

However if it is still needed, please feel free to re-open or create a new ticket.

Thanks! 🙏