You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "davsclaus (via GitHub)" <gi...@apache.org> on 2023/12/01 05:26:42 UTC

Re: [PR] CAMEL-20163: cleanup parsing HTTP status range (camel-vertx-http) [camel]

davsclaus commented on code in PR #12284:
URL: https://github.com/apache/camel/pull/12284#discussion_r1411626466


##########
components/camel-vertx/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpEndpoint.java:
##########
@@ -60,18 +61,23 @@ public VertxHttpComponent getComponent() {
     @Override
     protected void doInit() throws Exception {
         String range = configuration.getOkStatusCodeRange();
+        parseStatusRange(range);
+    }
+
+    private void parseStatusRange(String range) {
         if (!range.contains(",")) {
-            // default is 200-299 so lets optimize for this
-            if (range.contains("-")) {
-                minOkRange = Integer.parseInt(StringHelper.before(range, "-"));
-                maxOkRange = Integer.parseInt(StringHelper.after(range, "-"));
-            } else {
+            if (!HttpUtil.parseStatusRange(range, this::setRanges)) {
                 minOkRange = Integer.parseInt(range);
                 maxOkRange = minOkRange;
             }
         }
     }
 
+    private void setRanges(int minOkRange, int maxOkRange) {

Review Comment:
   Is this method in use ?



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org