Skip to content

Commit

Permalink
Merge pull request #19 from alex-berger/feature/from_client
Browse files Browse the repository at this point in the history
Add support for passing preconfigured isahc HttpClient instance.
  • Loading branch information
yoshuawuyts authored Jan 27, 2020
2 parents cc5ee28 + dca28e3 commit 98359bf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/isahc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ impl Default for IsahcClient {
impl IsahcClient {
/// Create a new instance.
pub fn new() -> Self {
Self::from_client(isahc::HttpClient::new().unwrap())
}

/// Create from externally initialized and configured client.
pub fn from_client(client: isahc::HttpClient) -> Self {
Self {
client: Arc::new(isahc::HttpClient::new().unwrap()),
client: Arc::new(client),
}
}
}
Expand Down

0 comments on commit 98359bf

Please sign in to comment.