From d2756413200ee38f265acab81552a101e22458e6 Mon Sep 17 00:00:00 2001 From: James Yang <26634873@qq.com> Date: Mon, 8 Jul 2024 13:16:46 +0000 Subject: [PATCH] fix: unwrap panic with more info --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 2db9b46..df8b57c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -260,11 +260,11 @@ impl + Send + Sync + 'static> MitmProxy { if uri.authority() == Some(&connect_authority) { send_request_connect.send_request(req).await } else { - let mut sender = proxy.connect(req.uri()).await.unwrap(); + let mut sender = proxy.connect(req.uri()).await.expect(&format!("connect uri: {}", req.uri())); sender.send_request(req).await } } else { - let mut sender = proxy.connect(req.uri()).await.unwrap(); + let mut sender = proxy.connect(req.uri()).await.expect(&format!("connect uri: {}", req.uri())); sender.send_request(req).await }; @@ -342,7 +342,7 @@ impl + Send + Sync + 'static> MitmProxy { )) } else { let uri = req.uri().clone(); - let mut sender = proxy.connect(req.uri()).await.unwrap(); + let mut sender = proxy.connect(req.uri()).await.expect(&format!("connect uri: {}", req.uri())); let (req, req_parts) = dup_request(req); let (status, res, res_upgrade) = match sender.send_request(req).await {