diff --git a/kube-client/src/client/body.rs b/kube-client/src/client/body.rs index 5997218d8..34f5278a3 100644 --- a/kube-client/src/client/body.rs +++ b/kube-client/src/client/body.rs @@ -10,10 +10,11 @@ use http_body::{Body as HttpBody, Frame, SizeHint}; use http_body_util::{combinators::UnsyncBoxBody, BodyExt}; /// A request body. +#[derive(Debug)] pub struct Body { kind: Kind, } - +/* impl fmt::Debug for Body { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let mut builder = f.debug_struct("Body"); @@ -23,8 +24,9 @@ impl fmt::Debug for Body { }; builder.finish() } -} +}*/ +#[derive(Debug)] enum Kind { Once(Option), Wrap(UnsyncBoxBody>), diff --git a/kube-client/src/client/mod.rs b/kube-client/src/client/mod.rs index cd6c9ac9e..280e9b496 100644 --- a/kube-client/src/client/mod.rs +++ b/kube-client/src/client/mod.rs @@ -169,6 +169,7 @@ impl Client { /// create a proxy server or application-level gateway between localhost and the API server. pub async fn send(&self, request: Request) -> Result> { let mut svc = self.inner.clone(); + tracing::trace!("actual send body: {:?}", request.body()); let res = svc .ready() .await @@ -254,7 +255,11 @@ impl Client { /// Perform a raw HTTP request against the API and get back the response /// as a string pub async fn request_text(&self, request: Request>) -> Result { - let res = self.send(request.map(Body::from)).await?; + let body = request.map(Body::from); + tracing::trace!("body: {body:?}"); + let res = self.send(body).await?; + tracing::trace!("requesting: {:?}: {}", res.version(), res.status().as_str()); + tracing::trace!("headers: {:?}", res.headers()); let res = handle_api_errors(res).await?; let body_bytes = res.into_body().collect().await?.to_bytes(); let text = String::from_utf8(body_bytes.to_vec()).map_err(Error::FromUtf8)?; @@ -305,8 +310,10 @@ impl Client { where T: Clone + DeserializeOwned, { - let res = self.send(request.map(Body::from)).await?; - // trace!("Streaming from {} -> {}", res.url(), res.status().as_str()); + let body = request.map(Body::from); + tracing::trace!("body: {body:?}"); + let res = self.send(body).await?; + tracing::trace!("Streaming {:?}: {}", res.version(), res.status().as_str()); tracing::trace!("headers: {:?}", res.headers()); let frames = FramedRead::new(