Skip to content

Commit 98359bf

Browse files
authored
Merge pull request #19 from alex-berger/feature/from_client
Add support for passing preconfigured isahc HttpClient instance.
2 parents cc5ee28 + dca28e3 commit 98359bf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/isahc.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,13 @@ impl Default for IsahcClient {
2121
impl IsahcClient {
2222
/// Create a new instance.
2323
pub fn new() -> Self {
24+
Self::from_client(isahc::HttpClient::new().unwrap())
25+
}
26+
27+
/// Create from externally initialized and configured client.
28+
pub fn from_client(client: isahc::HttpClient) -> Self {
2429
Self {
25-
client: Arc::new(isahc::HttpClient::new().unwrap()),
30+
client: Arc::new(client),
2631
}
2732
}
2833
}

0 commit comments

Comments
 (0)