diff --git a/crates/example/src/main.rs b/crates/example/src/main.rs index 02ee315..086b604 100644 --- a/crates/example/src/main.rs +++ b/crates/example/src/main.rs @@ -139,7 +139,9 @@ async fn api_overview() -> Json { /// Test default HttpClient creation async fn test_default_client() -> Json { let client = HttpClient::new(); - let result = client.request_with_options("https://httpbin.org/get", None).await; + let result = client + .request_with_options("https://httpbin.org/get", None) + .await; Json(TestResponse { endpoint: "/test/client/default".to_string(), @@ -156,7 +158,9 @@ async fn test_default_client() -> Json { /// Test HttpClient builder pattern async fn test_builder_client() -> Json { let client = HttpClient::builder().build(); - let result = client.request_with_options("https://httpbin.org/get", None).await; + let result = client + .request_with_options("https://httpbin.org/get", None) + .await; Json(TestResponse { endpoint: "/test/client/builder".to_string(), @@ -176,7 +180,9 @@ async fn test_timeout_client(Query(params): Query) -> Json Json { headers.insert("Accept".to_string(), "application/json".to_string()); let client = HttpClient::builder().with_default_headers(headers).build(); - let result = client.request_with_options("https://httpbin.org/get", None).await; + let result = client + .request_with_options("https://httpbin.org/get", None) + .await; Json(TestResponse { endpoint: "/test/client/headers".to_string(), @@ -231,7 +239,9 @@ async fn test_combined_config() -> Json { .with_timeout(Duration::from_secs(30)) .with_default_headers(headers) .build(); - let result = client.request_with_options("https://httpbin.org/get", None).await; + let result = client + .request_with_options("https://httpbin.org/get", None) + .await; Json(TestResponse { endpoint: "/test/client/combined".to_string(), @@ -365,7 +375,9 @@ async fn test_insecure_feature() -> Json { /// Test HTTP GET method async fn test_get_method() -> Json { let client = HttpClient::new(); - let result = client.request_with_options("https://httpbin.org/get", None).await; + let result = client + .request_with_options("https://httpbin.org/get", None) + .await; Json(TestResponse { endpoint: "/test/methods/get".to_string(), @@ -383,7 +395,9 @@ async fn test_get_method() -> Json { async fn test_post_method(Json(payload): Json) -> Json { let client = HttpClient::new(); let body = serde_json::to_vec(&payload).unwrap_or_default(); - let result = client.post_with_options("https://httpbin.org/post", &body, None).await; + let result = client + .post_with_options("https://httpbin.org/post", &body, None) + .await; Json(TestResponse { endpoint: "/test/methods/post".to_string(), @@ -404,7 +418,9 @@ async fn test_post_method(Json(payload): Json) -> Json { async fn test_put_method(Json(payload): Json) -> Json { let client = HttpClient::new(); let body = serde_json::to_vec(&payload).unwrap_or_default(); - let result = client.post_with_options("https://httpbin.org/put", &body, None).await; + let result = client + .post_with_options("https://httpbin.org/put", &body, None) + .await; Json(TestResponse { endpoint: "/test/methods/put".to_string(), @@ -424,7 +440,9 @@ async fn test_put_method(Json(payload): Json) -> Json { /// Test HTTP DELETE method (simulated via GET since library doesn't have DELETE yet) async fn test_delete_method() -> Json { let client = HttpClient::new(); - let result = client.request_with_options("https://httpbin.org/delete", None).await; + let result = client + .request_with_options("https://httpbin.org/delete", None) + .await; Json(TestResponse { endpoint: "/test/methods/delete".to_string(), @@ -721,7 +739,10 @@ async fn status_check() -> Json { .as_secs(); // Test basic client creation to verify library is working - let client_test = match HttpClient::new().request_with_options("https://httpbin.org/get", None).await { + let client_test = match HttpClient::new() + .request_with_options("https://httpbin.org/get", None) + .await + { Ok(_) => "operational", Err(_) => "degraded", }; diff --git a/crates/hyper-custom-cert/examples/self-signed-certs/main.rs b/crates/hyper-custom-cert/examples/self-signed-certs/main.rs index 1781169..dca6c44 100644 --- a/crates/hyper-custom-cert/examples/self-signed-certs/main.rs +++ b/crates/hyper-custom-cert/examples/self-signed-certs/main.rs @@ -30,7 +30,9 @@ async fn main() { .with_timeout(Duration::from_secs(10)) .with_root_ca_pem(ca_pem) .build(); - let _ = _rustls_client.request_with_options("https://private.local", None).await; + let _ = _rustls_client + .request_with_options("https://private.local", None) + .await; // Option 2: Load CA certificate from a file path // Note: This will panic if the file doesn't exist - ensure your cert file is available @@ -47,13 +49,17 @@ async fn main() { { // Shortcut: let _dev_client = HttpClient::with_self_signed_certs(); - let _ = _dev_client.request_with_options("https://localhost:8443", None).await; + let _ = _dev_client + .request_with_options("https://localhost:8443", None) + .await; // Or explicit builder method: let _dev_client2 = HttpClient::builder() .insecure_accept_invalid_certs(true) .build(); - let _ = _dev_client2.request_with_options("https://localhost:8443", None).await; + let _ = _dev_client2 + .request_with_options("https://localhost:8443", None) + .await; } println!("Example finished. See README for feature flags and commands."); diff --git a/crates/hyper-custom-cert/src/lib.rs b/crates/hyper-custom-cert/src/lib.rs index b83ea61..f57a04f 100644 --- a/crates/hyper-custom-cert/src/lib.rs +++ b/crates/hyper-custom-cert/src/lib.rs @@ -368,7 +368,8 @@ impl HttpClient { // Add any request-specific headers from options if let Some(options) = &options - && let Some(headers) = &options.headers { + && let Some(headers) = &options.headers + { for (key, value) in headers { req = req.header(key, value); } @@ -503,7 +504,8 @@ impl HttpClient { // Add any request-specific headers from options if let Some(options) = &options - && let Some(headers) = &options.headers { + && let Some(headers) = &options.headers + { for (key, value) in headers { req = req.header(key, value); }