Repository: quarkusio/quarkus
Issue: Regression/Change of behavior for root path when using quarkus-funqy-http on master

**Describe the bug**
When using `quarkus-funqy-http`, index.html is not displayed anymore when using the root path. If this is expected, please make this a configuration parameter.

This is blocking for codestarts because as soon as funqy is added, then the index.html is not accessible anymore from the root path.


**Expected behavior**
By default, the root should point to the index.html and not the funqy function, make it a configuration parameter if this is expected.

**To Reproduce**

Generate an application with "funqy http" and "resteasy" using code.quarkus.io, run it, browse http://0.0.0.0:8080, you get the index because it uses `1.9.1.Final`, swith to `999-SNAPSHOT` in the pom.xml:
```xml
<quarkus.platform.version>1.9.1.Final</quarkus.platform.version>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus-plugin.version>1.9.1.Final</quarkus-plugin.version>
```

browse http://0.0.0.0:8080, you get the funqy function result.

CC @matejvasek I see you have a recent PR that could be related https://github.com/quarkusio/quarkus/pull/12863



Changed files:
extensions/funqy/funqy-http/deployment/src/test/java/io/quarkus/funqy/test/SingleFunctionTest.java
extensions/funqy/funqy-http/deployment/src/main/java/io/quarkus/funqy/deployment/bindings/http/FunqyHttpBuildStep.java
extensions/funqy/funqy-http/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/http/FunqyHttpBindingRecorder.java
extensions/funqy/funqy-http/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/http/VertxRequestHandler.java
extensions/funqy/funqy-http/deployment/src/test/java/io/quarkus/funqy/test/SimpleTest.java
extensions/funqy/funqy-http/deployment/src/test/java/io/quarkus/funqy/test/RootPathTest.java
extensions/funqy/funqy-http/deployment/src/test/java/io/quarkus/funqy/test/SingleFunction.java

diff --git a/extensions/funqy/funqy-http/deployment/src/main/java/io/quarkus/funqy/deployment/bindings/http/FunqyHttpBuildStep.java b/extensions/funqy/funqy-http/deployment/src/main/java/io/quarkus/funqy/deployment/bindings/http/FunqyHttpBuildStep.java
index 319a34d3cce..23357901917 100644
--- a/extensions/funqy/funqy-http/deployment/src/main/java/io/quarkus/funqy/deployment/bindings/http/FunqyHttpBuildStep.java
+++ b/extensions/funqy/funqy-http/deployment/src/main/java/io/quarkus/funqy/deployment/bindings/http/FunqyHttpBuildStep.java
@@ -20,7 +20,6 @@
 import io.quarkus.deployment.builditem.ShutdownContextBuildItem;
 import io.quarkus.funqy.deployment.FunctionBuildItem;
 import io.quarkus.funqy.deployment.FunctionInitializedBuildItem;
-import io.quarkus.funqy.runtime.FunqyConfig;
 import io.quarkus.funqy.runtime.bindings.http.FunqyHttpBindingRecorder;
 import io.quarkus.jackson.ObjectMapperProducer;
 import io.quarkus.vertx.core.deployment.CoreVertxBuildItem;
@@ -58,7 +57,6 @@ public void staticInit(FunqyHttpBindingRecorder binding,
     @BuildStep
     @Record(RUNTIME_INIT)
     public void boot(ShutdownContextBuildItem shutdown,
-            FunqyConfig funqyConfig,
             FunqyHttpBindingRecorder binding,
             BuildProducer<FeatureBuildItem> feature,
             BuildProducer<RouteBuildItem> routes,
@@ -74,22 +72,19 @@ public void boot(ShutdownContextBuildItem shutdown,
         feature.produce(new FeatureBuildItem(FUNQY_HTTP_FEATURE));
 
         String rootPath = httpConfig.rootPath;
-        if (rootPath == null) {
-            rootPath = "/";
-        } else if (!rootPath.endsWith("/")) {
-            rootPath += "/";
-        }
-
         Handler<RoutingContext> handler = binding.start(rootPath,
-                funqyConfig,
                 vertx.getVertx(),
                 shutdown,
                 beanContainer.getValue(),
                 executorBuildItem.getExecutorProxy());
 
-        routes.produce(new RouteBuildItem("/", handler, false));
         for (FunctionBuildItem function : functions) {
+            if (rootPath == null)
+                rootPath = "/";
+            else if (!rootPath.endsWith("/"))
+                rootPath += "/";
             String name = function.getFunctionName() == null ? function.getMethodName() : function.getFunctionName();
+            //String path = rootPath + name;
             String path = "/" + name;
             routes.produce(new RouteBuildItem(path, handler, false));
         }
diff --git a/extensions/funqy/funqy-http/deployment/src/test/java/io/quarkus/funqy/test/RootPathTest.java b/extensions/funqy/funqy-http/deployment/src/test/java/io/quarkus/funqy/test/RootPathTest.java
index 6cc79e8b669..b53589de173 100644
--- a/extensions/funqy/funqy-http/deployment/src/test/java/io/quarkus/funqy/test/RootPathTest.java
+++ b/extensions/funqy/funqy-http/deployment/src/test/java/io/quarkus/funqy/test/RootPathTest.java
@@ -13,8 +13,7 @@
 
 public class RootPathTest {
     private static final String APP_PROPS = "" +
-            "quarkus.http.root-path=/api\\n" +
-            "quarkus.funqy.export=get\\n";
+            "quarkus.http.root-path=/api\\n";
 
     @RegisterExtension
     static QuarkusUnitTest test = new QuarkusUnitTest()
@@ -30,10 +29,6 @@ public void testGetOrPost() throws Exception {
                 .then().statusCode(200).body(equalTo("\\"get\\""));
         RestAssured.given().post("/get")
                 .then().statusCode(200).body(equalTo("\\"get\\""));
-        RestAssured.given().get("/")
-                .then().statusCode(200).body(equalTo("\\"get\\""));
-        RestAssured.given().post("/")
-                .then().statusCode(200).body(equalTo("\\"get\\""));
     }
 
 }
diff --git a/extensions/funqy/funqy-http/deployment/src/test/java/io/quarkus/funqy/test/SimpleTest.java b/extensions/funqy/funqy-http/deployment/src/test/java/io/quarkus/funqy/test/SimpleTest.java
index 34db8528013..2476d5f9b80 100644
--- a/extensions/funqy/funqy-http/deployment/src/test/java/io/quarkus/funqy/test/SimpleTest.java
+++ b/extensions/funqy/funqy-http/deployment/src/test/java/io/quarkus/funqy/test/SimpleTest.java
@@ -6,7 +6,6 @@
 import static org.hamcrest.Matchers.equalTo;
 
 import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.asset.StringAsset;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
@@ -18,13 +17,9 @@
 import io.restassured.RestAssured;
 
 public class SimpleTest {
-    private static final String APP_PROPS = "" +
-            "quarkus.funqy.export=toLowerCase\\n";
-
     @RegisterExtension
     static QuarkusUnitTest test = new QuarkusUnitTest()
             .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
-                    .addAsResource(new StringAsset(APP_PROPS), "application.properties")
                     .addClasses(PrimitiveFunctions.class, GreetingFunctions.class, Greeting.class, GreetingService.class,
                             GreetingTemplate.class));
 
@@ -35,12 +30,6 @@ public void testString(String path) {
                 .then().statusCode(200).body(equalTo("\\"hello\\""));
     }
 
-    @Test
-    public void testRoot() {
-        RestAssured.given().contentType("application/json").body("\\"Hello\\"").post("/")
-                .then().statusCode(200).body(equalTo("\\"hello\\""));
-    }
-
     @ParameterizedTest
     @ValueSource(strings = { "/doubleIt", "/doubleItAsync" })
     public void testInt(String path) {
diff --git a/extensions/funqy/funqy-http/deployment/src/test/java/io/quarkus/funqy/test/SingleFunction.java b/extensions/funqy/funqy-http/deployment/src/test/java/io/quarkus/funqy/test/SingleFunction.java
deleted file mode 100644
index 39c8097cd3d..00000000000
--- a/extensions/funqy/funqy-http/deployment/src/test/java/io/quarkus/funqy/test/SingleFunction.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package io.quarkus.funqy.test;
-
-import io.quarkus.funqy.Funq;
-
-public class SingleFunction {
-
-    @Funq
-    public String echo(String msg) {
-        return msg;
-    }
-}
diff --git a/extensions/funqy/funqy-http/deployment/src/test/java/io/quarkus/funqy/test/SingleFunctionTest.java b/extensions/funqy/funqy-http/deployment/src/test/java/io/quarkus/funqy/test/SingleFunctionTest.java
deleted file mode 100644
index 2f0157a4a43..00000000000
--- a/extensions/funqy/funqy-http/deployment/src/test/java/io/quarkus/funqy/test/SingleFunctionTest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package io.quarkus.funqy.test;
-
-import static org.hamcrest.Matchers.equalTo;
-
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
-
-import io.quarkus.test.QuarkusUnitTest;
-import io.restassured.RestAssured;
-
-public class SingleFunctionTest {
-    @RegisterExtension
-    static QuarkusUnitTest test = new QuarkusUnitTest()
-            .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
-                    .addClasses(SingleFunction.class));
-
-    @Test
-    public void testRoot() {
-        // When single function is registered by @Funq, the function is mapped also to "/"
-        RestAssured.given().contentType("application/json").body("\\"Some string.\\"").post("/")
-                .then().statusCode(200).body(equalTo("\\"Some string.\\""));
-    }
-}
diff --git a/extensions/funqy/funqy-http/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/http/FunqyHttpBindingRecorder.java b/extensions/funqy/funqy-http/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/http/FunqyHttpBindingRecorder.java
index 0b8cb341029..8ef53255364 100644
--- a/extensions/funqy/funqy-http/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/http/FunqyHttpBindingRecorder.java
+++ b/extensions/funqy/funqy-http/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/http/FunqyHttpBindingRecorder.java
@@ -15,7 +15,6 @@
 import io.quarkus.funqy.runtime.FunctionConstructor;
 import io.quarkus.funqy.runtime.FunctionInvoker;
 import io.quarkus.funqy.runtime.FunctionRecorder;
-import io.quarkus.funqy.runtime.FunqyConfig;
 import io.quarkus.funqy.runtime.query.QueryObjectMapper;
 import io.quarkus.funqy.runtime.query.QueryReader;
 import io.quarkus.runtime.ShutdownContext;
@@ -60,7 +59,6 @@ private ObjectMapper getObjectMapper() {
     }
 
     public Handler<RoutingContext> start(String contextPath,
-            FunqyConfig funqyConfig,
             Supplier<Vertx> vertx,
             ShutdownContext shutdown,
             BeanContainer beanContainer,
@@ -75,18 +73,6 @@ public void run() {
         });
         FunctionConstructor.CONTAINER = beanContainer;
 
-        final FunctionInvoker defaultInvoker;
-        if (funqyConfig.export.isPresent()) {
-            defaultInvoker = FunctionRecorder.registry.matchInvoker(funqyConfig.export.get());
-            if (defaultInvoker == null) {
-                throw new RuntimeException("quarkus.funqy.export value does not map a function: " + funqyConfig.export.get());
-            }
-        } else if (FunctionRecorder.registry.invokers().size() == 1) {
-            defaultInvoker = FunctionRecorder.registry.invokers().iterator().next();
-        } else {
-            defaultInvoker = null;
-        }
-
-        return new VertxRequestHandler(vertx.get(), defaultInvoker, beanContainer, contextPath, executor);
+        return new VertxRequestHandler(vertx.get(), beanContainer, contextPath, executor);
     }
 }
diff --git a/extensions/funqy/funqy-http/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/http/VertxRequestHandler.java b/extensions/funqy/funqy-http/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/http/VertxRequestHandler.java
index f1c0a9b9c4b..04ebc543593 100644
--- a/extensions/funqy/funqy-http/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/http/VertxRequestHandler.java
+++ b/extensions/funqy/funqy-http/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/http/VertxRequestHandler.java
@@ -39,15 +39,12 @@ public class VertxRequestHandler implements Handler<RoutingContext> {
     protected final CurrentIdentityAssociation association;
     protected final CurrentVertxRequest currentVertxRequest;
     protected final Executor executor;
-    protected final FunctionInvoker defaultInvoker;
 
     public VertxRequestHandler(Vertx vertx,
-            FunctionInvoker defaultInvoker,
             BeanContainer beanContainer,
             String rootPath,
             Executor executor) {
         this.vertx = vertx;
-        this.defaultInvoker = defaultInvoker;
         this.beanContainer = beanContainer;
         // make sure rootPath ends with "/" for easy parsing
         if (rootPath == null) {
@@ -79,12 +76,7 @@ public void handle(RoutingContext routingContext) {
 
         path = path.substring(rootPath.length());
 
-        final FunctionInvoker invoker;
-        if (!path.isEmpty()) {
-            invoker = FunctionRecorder.registry.matchInvoker(path);
-        } else {
-            invoker = defaultInvoker;
-        }
+        FunctionInvoker invoker = FunctionRecorder.registry.matchInvoker(path);
 
         if (invoker == null) {
             routingContext.fail(404);