if (branch.isLoggable(logHeaders)) {
// Request headers
TreeLogger headers = branch.branch(logHeaders, "Request headers");
Iterator<Field> headerFields = request.getConnection().getRequestFields().getFields();
while (headerFields.hasNext()) {
Field headerField = headerFields.next();
headers.log(logHeaders, headerField.getName() + ": "
+ headerField.getValue());
}
// Response headers
headers = branch.branch(logHeaders, "Response headers");
headerFields = response.getHttpFields().getFields();
while (headerFields.hasNext()) {
Field headerField = headerFields.next();
headers.log(logHeaders, headerField.getName() + ": "
+ headerField.getValue());
}
}
}
}