From 41623a2b4ea15e0716de629a4765ab8f37eeb513 Mon Sep 17 00:00:00 2001 From: hatoo Date: Thu, 7 Nov 2024 21:33:35 +0900 Subject: [PATCH] doc --- examples/https.rs | 2 +- src/lib.rs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/https.rs b/examples/https.rs index 7ef008d..c972dc2 100644 --- a/examples/https.rs +++ b/examples/https.rs @@ -109,7 +109,7 @@ async fn main() { let service = service_fn(move |req| { let client = client.clone(); - MitmProxy::hyper_service( + MitmProxy::wrap_service( proxy.clone(), req, service_fn(move |req| { diff --git a/src/lib.rs b/src/lib.rs index 23ea465..feaa905 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -88,7 +88,7 @@ impl + Send + Sync + 'static> MitmProxy { .serve_connection( TokioIo::new(stream), service_fn(|req| { - Self::hyper_service(proxy.clone(), req, service.clone()) + Self::wrap_service(proxy.clone(), req, service.clone()) }), ) .with_upgrades() @@ -101,11 +101,12 @@ impl + Send + Sync + 'static> MitmProxy { }) } - /// A service that can be used with hyper server. + /// Transform a service to a service that can be used in hyper server. + /// URL for requests that passed to service are full URL including scheme. /// See `examples/https.rs` for usage. /// If you want to serve simple HTTP proxy server, you can use `bind` method instead. /// `bind` will call this method internally. - pub async fn hyper_service( + pub async fn wrap_service( proxy: Arc, req: Request, mut service: S,