Skip to content

Commit

Permalink
success message: body is optional
Browse files Browse the repository at this point in the history
  • Loading branch information
rsehr committed Dec 10, 2024
1 parent aef822d commit 08c64c6
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -547,10 +547,11 @@ private boolean sendResponseViaRest(String method, String url, String json) {
}

try (CloseableHttpClient client = HttpClients.createDefault()) {
httpBase.setHeader("Accept", "application/json");
httpBase.setHeader("Content-type", "application/json");
httpBase.setEntity(new StringEntity(json));

if (StringUtils.isNotBlank(json)) {
httpBase.setHeader("Accept", "application/json");
httpBase.setHeader("Content-type", "application/json");
httpBase.setEntity(new StringEntity(json));
}
log.info("Executing request " + httpBase.getRequestLine());

String responseBody = client.execute(httpBase, HttpUtils.stringResponseHandler);
Expand Down

0 comments on commit 08c64c6

Please sign in to comment.