dulvac commented on code in PR #42:
URL:
https://github.com/apache/sling-org-apache-sling-testing-clients/pull/42#discussion_r1081317327
##########
src/main/java/org/apache/sling/testing/clients/util/ServerErrorRetryStrategy.java:
##########
@@ -80,4 +83,41 @@ private boolean responseRetryCondition(final HttpResponse
response, int... expec
statusCode < SC_INTERNAL_SERVER_ERROR + 100;
}
}
+
+ /**
+ * Best effort attempt to build a request detail string for logging.
+ */
+ private String getRequestDetails(HttpContext context) {
+ String details = "Not available";
+ HttpClientContext clientContext = HttpClientContext.adapt(context);
+ HttpRequestWrapper wrapper =
clientContext.getAttribute(HttpClientContext.HTTP_REQUEST,
HttpRequestWrapper.class);
+ if (wrapper != null) {
+ // Build a request detail string like following example:
+ // GET /test/internalerror/resource HTTP/1.1 [Host:
127.0.0.1:35049, Connection: Keep-Alive, User-Agent: Java, Accept-Encoding:
gzip,deflate, Authorization: Basic dXNlcjpwYXNz]
+ final StringBuilder sb = new
StringBuilder(wrapper.getRequestLine().toString());
+ sb.append(" [");
+ Arrays.stream(wrapper.getAllHeaders()).forEach(header ->
sb.append(header.getName()).append(": ").append(header.getValue()).append(",
"));
Review Comment:
minor: wrap lines to 120 please (everywhere, if possible)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]