Skip to content

Commit 9251780

Browse files
committed
Add a VssClient::from_client constructor
We add a `VssClient::from_client` constructor that allows users to hand in a preconfigured `reqwest::Client`, which is particularily useful to allow them to set default headers, e.g., for header-based authentication.
1 parent 23d6f0a commit 9251780

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/client.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ impl VssClient {
2020
/// Constructs a [`VssClient`] using `base_url` as the VSS server endpoint.
2121
pub fn new(base_url: &str) -> Self {
2222
let client = Client::new();
23+
Self::from_client(base_url, client)
24+
}
25+
26+
/// Constructs a [`VssClient`] from a given [`reqwest::Client`], using `base_url` as the VSS server endpoint.
27+
pub fn from_client(base_url: &str, client: Client) -> Self {
2328
Self { base_url: String::from(base_url), client }
2429
}
2530

0 commit comments

Comments
 (0)