Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blocking client #13

Open
jtran opened this issue Jan 9, 2024 · 2 comments
Open

Blocking client #13

jtran opened this issue Jan 9, 2024 · 2 comments

Comments

@jtran
Copy link
Contributor

jtran commented Jan 9, 2024

Hi, first of all, it's awesome to see a library inspired by Ruby vcr. Nice work!

When making requests to an API as a client, not a server, the extra complexity of async is often not needed. In fact, the use case of consuming an API and using vcr to test it is exactly the case where, in my opinion, async is likely not needed.

Are there plans to add support for the synchronous, blocking client reqwest::blocking::Client? I don't think reqwest-middleware supports it, so either that would need to happen or another approach would need to be taken.

@mksh
Copy link
Contributor

mksh commented Mar 5, 2024

I looked through reqwest::blocking module, and it lacks pluggable middleware support now, so while it's in theory possible, would require to expose some wrapper/facade interface around the reqwest::blocking::Client struct (similar how reqwest_middleware does that for async client).

This means augmenting rvcr interface with new symbols that will act differently from the things that library already implements. I myself don't use blocking reqwest now, so can't really decide on the best approach for designing such wrapper. If you or other folks from community can come up with PR suggesting such interface, that would be great.

@jtran
Copy link
Contributor Author

jtran commented Mar 7, 2024

Thank you for the consideration. I know that supporting both async and sync in rust is currently not easy. Here's an interesting article on the topic: https://nullderef.com/blog/rust-async-sync/. Feel free to close this issue if you like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants