diff --git a/src/net/system.rs b/src/net/system.rs index 448bfb2..c35e75d 100644 --- a/src/net/system.rs +++ b/src/net/system.rs @@ -32,15 +32,17 @@ struct Plan { response: reqwest::Response, } impl Plan { - #[tracing::instrument] + #[tracing::instrument(skip(self))] fn matches(&self, request: &Request) -> bool { let url = request.url(); let is_match = self.match_request.iter().all(|criteria| match criteria { MatchRequest::Body(body) => { + tracing::trace!(body = ?request.body(), "BODY"); request.body().and_then(reqwest::Body::as_bytes) == Some(body) } MatchRequest::Header { name, value } => { + tracing::trace!(%name, %value, "HEADER"); request .headers() .iter() @@ -51,13 +53,29 @@ impl Plan { request_header_name.as_str() == name && request_header_value == value }) } - MatchRequest::Method(method) => request.method() == http::Method::from(method), - MatchRequest::Scheme(scheme) => url.scheme() == scheme, - MatchRequest::Host(host) => url.host_str() == Some(host), - MatchRequest::Path(path) => url.path() == path, - MatchRequest::Fragment(fragment) => url.fragment() == Some(fragment), + MatchRequest::Method(method) => { + tracing::trace!(%method, "METHOD"); + request.method() == http::Method::from(method) + } + MatchRequest::Scheme(scheme) => { + tracing::trace!(%scheme, "SCHEME"); + url.scheme() == scheme + } + MatchRequest::Host(host) => { + tracing::trace!(%host,"HOST"); + url.host_str() == Some(host) + } + MatchRequest::Path(path) => { + tracing::trace!(%path,"PATH"); + url.path() == path + } + MatchRequest::Fragment(fragment) => { + tracing::trace!(%fragment,"FRAGMENT"); + url.fragment() == Some(fragment) + } MatchRequest::Query { name, value } => url.query_pairs().into_iter().any( |(request_query_name, request_query_value)| { + tracing::trace!(%name, %value, "QUERY"); request_query_name.as_ref() == name && request_query_value.as_ref() == value }, ), @@ -384,7 +402,7 @@ impl<'net> ReqBuilder<'net> { let client = self.net.client(); // URL let mut url = self.url; - tracing::trace!(?url); + tracing::trace!(%url); // Query Parameters if !self.query.is_empty() { url.push('?');