1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-28 01:32:57 +01:00

add debug formatter for ClientRequestBuilder

This commit is contained in:
Nikolay Kim 2018-03-13 15:09:05 -07:00
parent e27bbaa55c
commit fd0bb54469

View File

@ -599,3 +599,19 @@ fn parts<'a>(parts: &'a mut Option<ClientRequest>, err: &Option<HttpError>)
}
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)")
}
}
}