Skip to content

Commit

Permalink
fixed webhooks' response codes should be in the 2xx range, not just 200
Browse files Browse the repository at this point in the history
  • Loading branch information
albogdano committed Mar 31, 2021
1 parent f830274 commit a709822
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions para-server/src/main/java/com/erudika/para/queue/River.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ protected int processWebhookPayload(String appid, String id, Map<String, Object>
boolean ok = false;
String status = "";
try (CloseableHttpResponse resp1 = HTTP.execute(postToTarget)) {
if (resp1 != null && resp1.getStatusLine().getStatusCode() != 200) {
if (resp1 != null && Math.abs(resp1.getStatusLine().getStatusCode() - 200) <= 10) {
status = resp1.getStatusLine().getReasonPhrase();
logger.info("Webhook {} delivery failed! {} responded with {} {} instead of 200 OK.", id,
logger.info("Webhook {} delivery failed! {} responded with code {} {} instead of 2xx.", id,
targetUrl, resp1.getStatusLine().getStatusCode(), resp1.getStatusLine().getReasonPhrase());
} else {
logger.debug("Webhook {} delivered to {} successfully.", id, targetUrl);
Expand Down

0 comments on commit a709822

Please sign in to comment.