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

allow using httpcache without depending on reqwest directly #96

Open
tamird opened this issue Dec 12, 2024 · 2 comments
Open

allow using httpcache without depending on reqwest directly #96

tamird opened this issue Dec 12, 2024 · 2 comments

Comments

@tamird
Copy link

tamird commented Dec 12, 2024

reqwest types are part of the public API via Client::custom. this is pretty inconvenient because downstream users have to take a direct dependency on reqwest in order to use httpcache. It is additionally inconvenient that the version of reqwest used by the downstream user must match (or be compatible with) the version used in octorust (or other clients).

Possible solutions:

  • provide a constructor that takes httpcache but not the client.
  • re-export the necessary reqwest types.
@augustuswm
Copy link
Contributor

augustuswm commented Dec 12, 2024

That all makes sense to me. We are trying to sort out some of the dependency headaches with #95 . But it doesn't resolve the reqwest dependency.

I think the easiest thing here would be to add a with_http_cache method that will allow replacing the httpcache after a client has been constructed.

@tamird
Copy link
Author

tamird commented Dec 12, 2024

That would be easy, but mutability also stinks :)

Another constructor would be ideal. While you're at it, octorust's client::new returns Result but the implementation is in fact infallible.

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