From fd0bb54469bf94d340c5f28a13ea590405709dce Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Tue, 13 Mar 2018 15:09:05 -0700 Subject: [PATCH] add debug formatter for ClientRequestBuilder --- src/client/request.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/client/request.rs b/src/client/request.rs index 1f564753..c5c95eb8 100644 --- a/src/client/request.rs +++ b/src/client/request.rs @@ -599,3 +599,19 @@ fn parts<'a>(parts: &'a mut Option, err: &Option) } parts.as_mut() } + +impl fmt::Debug for ClientRequestBuilder { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + if let Some(ref parts) = self.request { + let res = write!(f, "\nClientRequestBuilder {:?} {}:{}\n", + parts.version, parts.method, parts.uri); + let _ = write!(f, " headers:\n"); + for (key, val) in parts.headers.iter() { + let _ = write!(f, " {:?}: {:?}\n", key, val); + } + res + } else { + write!(f, "ClientRequestBuilder(Consumed)") + } + } +}