http-rs / surf

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

Allow surf to build without a default client #236

Closed jbr closed 3 years ago

jbr commented 3 years ago

This PR:

Not covered by this PR: Considering what happens if someone enables multiple backends.

There are exactly two places that panic in this PR that would not have panicked otherwise. We could return a custom error if that's preferred, although it seems like "trying to send a request without a default client backend and without an explicitly configured http_client" is exactly the sort of developer-caused error scenario that panics are ideal for. This also should be a fairly rare condition, because anyone using surf without default features likely understands that they can't rely on a default client.