Skip to content

Commit

Permalink
Add more debug logging on the HTTPClientService
Browse files Browse the repository at this point in the history
  • Loading branch information
waynebeaton committed Feb 7, 2025
1 parent 9b16161 commit 7650f53
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class HttpClientService implements IHttpClientService {
@Override
public int post(String url, String contentType, String payload, Consumer<String> handler) {
try {
logger.debug("HTTP POST: {}", url);
var tries = 0;
while (true) {
Duration timeout = Duration.ofSeconds(settings.getTimeout());
Expand All @@ -66,9 +67,17 @@ public int post(String url, String contentType, String payload, Consumer<String>
Thread.sleep(1000 * tries);
continue;
}

logger.debug("HTTP Status: {}", response.statusCode());

if (logger.isDebugEnabled()) {
response.headers().map().forEach((key,value) -> logger.debug("HTTP Response: {} -> {}", key, value));
}

if (response.statusCode() == 200) {
handler.accept(response.body());
}

return response.statusCode();
}
} catch (IOException | InterruptedException e) {
Expand Down

0 comments on commit 7650f53

Please sign in to comment.