Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "httpc-test"
version = "0.1.10"
version = "0.1.11"
edition = "2021"
authors = ["Jeremy Chone <[email protected]>"]
license = "MIT OR Apache-2.0"
Expand All @@ -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"] }
Expand Down
15 changes: 15 additions & 0 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ pub fn new_client(base_url: impl Into<BaseUrl>) -> Result<Client> {
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<BaseUrl>,
reqwest_builder: reqwest::ClientBuilder,
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;