wip: chore: fix bug for unused

This commit is contained in:
Jun Kurihara 2023-12-09 03:41:32 +09:00
commit cdcb1b13da
No known key found for this signature in database
GPG key ID: 48ADFD173ED22B03
3 changed files with 9 additions and 4 deletions

View file

@ -2,7 +2,7 @@ use crate::{
error::{RpxyError, RpxyResult}, error::{RpxyError, RpxyResult},
globals::Globals, globals::Globals,
hyper_ext::{ hyper_ext::{
body::{wrap_incoming_body_response, IncomingOr}, body::{wrap_incoming_body_response, BoxBody, IncomingOr},
rt::LocalExecutor, rt::LocalExecutor,
}, },
log::*, log::*,
@ -19,7 +19,7 @@ use std::sync::Arc;
#[cfg(feature = "cache")] #[cfg(feature = "cache")]
use super::cache::{get_policy_if_cacheable, RpxyCache}; use super::cache::{get_policy_if_cacheable, RpxyCache};
#[cfg(feature = "cache")] #[cfg(feature = "cache")]
use crate::hyper_ext::body::{full, BoxBody}; use crate::hyper_ext::body::{full, wrap_synthetic_body_response};
#[cfg(feature = "cache")] #[cfg(feature = "cache")]
use http_body_util::BodyExt; use http_body_util::BodyExt;
@ -89,13 +89,16 @@ where
// }; // };
// response with cached body // 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 // No cache handling
#[cfg(not(feature = "cache"))] #[cfg(not(feature = "cache"))]
{ {
self.request_directly(req).await.map(wrap_incoming_body_response::<B2>) self
.request_directly(req)
.await
.map(wrap_incoming_body_response::<BoxBody>)
} }
} }
} }

View file

@ -1,3 +1,4 @@
#[cfg(feature = "cache")]
mod cache; mod cache;
mod client; mod client;

View file

@ -8,6 +8,7 @@ pub(crate) mod rt {
} }
pub(crate) mod body { pub(crate) mod body {
pub(crate) use super::body_incoming_like::IncomingLike; pub(crate) use super::body_incoming_like::IncomingLike;
#[allow(unused)]
pub(crate) use super::body_type::{ pub(crate) use super::body_type::{
empty, full, wrap_incoming_body_response, wrap_synthetic_body_response, BoxBody, IncomingOr, empty, full, wrap_incoming_body_response, wrap_synthetic_body_response, BoxBody, IncomingOr,
}; };