Improve debug logging (#781)

This commit is contained in:
Sean McArthur
2020-01-13 12:24:38 -08:00
committed by GitHub
parent 1478313756
commit 14908ad3f0
4 changed files with 40 additions and 8 deletions

View File

@@ -1189,13 +1189,13 @@ impl Future for PendingRequest {
match action {
redirect::ActionKind::Follow => {
debug!("redirecting '{}' to '{}'", self.url, loc);
self.url = loc;
let mut headers =
std::mem::replace(self.as_mut().headers(), HeaderMap::new());
remove_sensitive_headers(&mut headers, &self.url, &self.urls);
debug!("redirecting to {:?} '{}'", self.method, self.url);
let uri = expect_uri(&self.url);
let body = match self.body {
Some(Some(ref body)) => Body::reusable(body.clone()),
@@ -1224,7 +1224,7 @@ impl Future for PendingRequest {
continue;
}
redirect::ActionKind::Stop => {
debug!("redirect_policy disallowed redirection to '{}'", loc);
debug!("redirect policy disallowed redirection to '{}'", loc);
}
redirect::ActionKind::Error(err) => {
return Poll::Ready(Err(crate::error::redirect(
@@ -1235,6 +1235,8 @@ impl Future for PendingRequest {
}
}
}
debug!("response '{}' for {}", res.status(), self.url);
let res = Response::new(res, self.url.clone(), self.client.gzip, self.timeout.take());
return Poll::Ready(Ok(res));
}