You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2023/08/07 13:49:17 UTC

[camel] 02/02: CAMEL-19647: use 503 for health check DOWN

This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 85047346b5567153e8ac249223f006fdee132f2c
Author: Nikita Konovalov <nk...@redhat.com>
AuthorDate: Thu Aug 3 16:03:05 2023 +0200

    CAMEL-19647: use 503 for health check DOWN
---
 .../org/apache/camel/component/platform/http/main/MainHttpServer.java   | 2 +-
 .../apache/camel/component/platform/http/main/MainHttpServerTest.java   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/MainHttpServer.java b/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/MainHttpServer.java
index 1faf36fc704..e80cf310cc3 100644
--- a/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/MainHttpServer.java
+++ b/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/MainHttpServer.java
@@ -352,7 +352,7 @@ public class MainHttpServer extends ServiceSupport implements CamelContextAware,
 
                 if (!up) {
                     // we need to fail with a http status so lets use 500
-                    ctx.response().setStatusCode(500);
+                    ctx.response().setStatusCode(503);
                 }
                 ctx.end(sb.toString());
             }
diff --git a/components/camel-platform-http-main/src/test/java/org/apache/camel/component/platform/http/main/MainHttpServerTest.java b/components/camel-platform-http-main/src/test/java/org/apache/camel/component/platform/http/main/MainHttpServerTest.java
index 251627cd9c6..3979e1ac740 100644
--- a/components/camel-platform-http-main/src/test/java/org/apache/camel/component/platform/http/main/MainHttpServerTest.java
+++ b/components/camel-platform-http-main/src/test/java/org/apache/camel/component/platform/http/main/MainHttpServerTest.java
@@ -55,7 +55,7 @@ class MainHttpServerTest {
 
         HttpResponse<String> response = HttpClient.newBuilder().build().send(request, HttpResponse.BodyHandlers.ofString());
 
-        assertEquals(500, response.statusCode());
+        assertEquals(503, response.statusCode());
 
     }