From cdcb1b13dacc88fb004d1166070f05f087434fed Mon Sep 17 00:00:00 2001 From: Jun Kurihara Date: Sat, 9 Dec 2023 03:41:32 +0900 Subject: [PATCH] wip: chore: fix bug for unused --- rpxy-lib/src/forwarder/client.rs | 11 +++++++---- rpxy-lib/src/forwarder/mod.rs | 1 + rpxy-lib/src/hyper_ext/mod.rs | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/rpxy-lib/src/forwarder/client.rs b/rpxy-lib/src/forwarder/client.rs index 820523e..9aab75a 100644 --- a/rpxy-lib/src/forwarder/client.rs +++ b/rpxy-lib/src/forwarder/client.rs @@ -2,7 +2,7 @@ use crate::{ error::{RpxyError, RpxyResult}, globals::Globals, hyper_ext::{ - body::{wrap_incoming_body_response, IncomingOr}, + body::{wrap_incoming_body_response, BoxBody, IncomingOr}, rt::LocalExecutor, }, log::*, @@ -19,7 +19,7 @@ use std::sync::Arc; #[cfg(feature = "cache")] use super::cache::{get_policy_if_cacheable, RpxyCache}; #[cfg(feature = "cache")] -use crate::hyper_ext::body::{full, BoxBody}; +use crate::hyper_ext::body::{full, wrap_synthetic_body_response}; #[cfg(feature = "cache")] use http_body_util::BodyExt; @@ -89,13 +89,16 @@ where // }; // response with cached body - Ok(Response::from_parts(parts, IncomingOr::Right(full(bytes)))) + Ok(wrap_synthetic_body_response(Response::from_parts(parts, full(bytes)))) } // No cache handling #[cfg(not(feature = "cache"))] { - self.request_directly(req).await.map(wrap_incoming_body_response::) + self + .request_directly(req) + .await + .map(wrap_incoming_body_response::) } } } diff --git a/rpxy-lib/src/forwarder/mod.rs b/rpxy-lib/src/forwarder/mod.rs index e901c7d..286cb40 100644 --- a/rpxy-lib/src/forwarder/mod.rs +++ b/rpxy-lib/src/forwarder/mod.rs @@ -1,3 +1,4 @@ +#[cfg(feature = "cache")] mod cache; mod client; diff --git a/rpxy-lib/src/hyper_ext/mod.rs b/rpxy-lib/src/hyper_ext/mod.rs index e1b5ae8..e6c81e7 100644 --- a/rpxy-lib/src/hyper_ext/mod.rs +++ b/rpxy-lib/src/hyper_ext/mod.rs @@ -8,6 +8,7 @@ pub(crate) mod rt { } pub(crate) mod body { pub(crate) use super::body_incoming_like::IncomingLike; + #[allow(unused)] pub(crate) use super::body_type::{ empty, full, wrap_incoming_body_response, wrap_synthetic_body_response, BoxBody, IncomingOr, };