diff --git a/Cargo.toml b/Cargo.toml index 398d331..3bc5730 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "httpc-test" -version = "0.1.10" +version = "0.1.11" edition = "2021" authors = ["Jeremy Chone "] license = "MIT OR Apache-2.0" @@ -19,7 +19,7 @@ color-output = ["url", "colored_json", "colored"] [dependencies] tokio = { version = "1", features = ["full"] } thiserror = "1" -reqwest = {version = "0.12", features = ["cookies", "json"]} +reqwest = {version = "0.12", features = ["cookies", "json", "default-tls"]} reqwest_cookie_store = "0.8" cookie = "0.18" serde = { version = "1", features = ["derive"] } diff --git a/src/client.rs b/src/client.rs index 280b281..c2ca278 100644 --- a/src/client.rs +++ b/src/client.rs @@ -27,6 +27,21 @@ pub fn new_client(base_url: impl Into) -> Result { new_client_with_reqwest(base_url, reqwest_builder) } +/// Create a configurable `httpc_test::Client` by passing a non default `reqwest::ClientBuilder`. +/// +/// # Example +/// +/// ``` +/// use httpc_test::ClientBuilder; +/// // Create a new httpc_test::Client, that can interact with +/// // servers that use self-signed certificates (e.g. for local development). +/// let client_builder = ClientBuilder::new() +/// .danger_accept_invalid_certs(true) +/// .danger_accept_invalid_hostnames(true) +/// .https_only(true); +/// let hc = httpc_test::new_client_with_reqwest("https://localhost:8080", client_builder) +/// .expect("httpc_test::new_client_with_reqwest() failed"); +/// ``` pub fn new_client_with_reqwest( base_url: impl Into, reqwest_builder: reqwest::ClientBuilder, diff --git a/src/lib.rs b/src/lib.rs index 248f688..8dcfc81 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,3 +11,4 @@ pub use crate::client::Client; pub use crate::cookie::Cookie; pub use crate::error::Error; pub use crate::response::Response; +pub use reqwest::ClientBuilder; \ No newline at end of file