http-rs / surf

Fast and friendly HTTP client framework for async Rust
https://docs.rs/surf
Apache License 2.0
1.47k stars 120 forks source link

re-export client types and `isahc::Error` #110

Open abonander opened 4 years ago

abonander commented 4 years ago

As it stands, Client<NativeClient>, Client<IsahcClient> and friends are not nameable by consumers of the crate, which causes issues if the user wants to put a client in a struct.

Additionally, IsahcClient wraps isahc::Error into Exception, so if you want to downcast you need to add the right version of isahc as a dependency: https://www.reddit.com/r/rust/comments/dy273n/hey_rustaceans_got_an_easy_question_ask_here/f8badd4/

(I'm posting this before that user has replied so I'm not 100% sure if that's the problem they're running into.)

yoshuawuyts commented 4 years ago

I don't think Surf would want to re-export Isahc::Error, but I've filed https://github.com/http-rs/http-client/issues/6 so the http-client impl can.

Additionally https://github.com/http-rs/surf/issues/96 also covers the generic type issue. Thanks!

3699n commented 4 years ago

Any updates on this? I need to put a client in a struct, but am not able to do so. A work around would be fine for now as well.