From 1d839e9fe9d365163c90e761d348c573aca0f6df Mon Sep 17 00:00:00 2001 From: Andy Damevin Date: Fri, 1 Jul 2022 15:38:18 +0200 Subject: [PATCH] Fix non-Get request in proxy dev-mode --- .../quinoa/test/devmode/ForwardedDevModeTest.java | 9 +++++++++ .../io/quarkiverse/quinoa/QuinoaDevProxyHandler.java | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/deployment/src/test/java/io/quarkiverse/quinoa/test/devmode/ForwardedDevModeTest.java b/deployment/src/test/java/io/quarkiverse/quinoa/test/devmode/ForwardedDevModeTest.java index 5e24e867..0ba57eab 100644 --- a/deployment/src/test/java/io/quarkiverse/quinoa/test/devmode/ForwardedDevModeTest.java +++ b/deployment/src/test/java/io/quarkiverse/quinoa/test/devmode/ForwardedDevModeTest.java @@ -1,7 +1,9 @@ package io.quarkiverse.quinoa.test.devmode; +import static io.restassured.RestAssured.given; import static org.hamcrest.Matchers.is; +import io.restassured.http.ContentType; import org.hamcrest.Matchers; import org.jboss.shrinkwrap.api.asset.StringAsset; import org.junit.jupiter.api.Test; @@ -10,6 +12,8 @@ import io.quarkus.test.QuarkusDevModeTest; import io.restassured.RestAssured; +import javax.ws.rs.core.MediaType; + public class ForwardedDevModeTest { @RegisterExtension final static QuarkusDevModeTest test = new QuarkusDevModeTest() @@ -27,5 +31,10 @@ public void testWebUI() { .statusCode(200) .header("Content-Encoding", Matchers.nullValue()) .body(is("live-coding\n")); + given() + .body("{}") + .contentType(ContentType.JSON) + .when().post("/api/something").then() + .statusCode(404); } } diff --git a/runtime/src/main/java/io/quarkiverse/quinoa/QuinoaDevProxyHandler.java b/runtime/src/main/java/io/quarkiverse/quinoa/QuinoaDevProxyHandler.java index 656cef5d..33821709 100644 --- a/runtime/src/main/java/io/quarkiverse/quinoa/QuinoaDevProxyHandler.java +++ b/runtime/src/main/java/io/quarkiverse/quinoa/QuinoaDevProxyHandler.java @@ -4,6 +4,7 @@ import static io.quarkiverse.quinoa.QuinoaRecorder.isIgnored; import static io.quarkiverse.quinoa.QuinoaRecorder.next; import static io.quarkiverse.quinoa.QuinoaRecorder.resolvePath; +import static io.quarkiverse.quinoa.QuinoaRecorder.shouldHandleMethod; import java.util.List; @@ -42,6 +43,10 @@ class QuinoaDevProxyHandler implements Handler { @Override public void handle(final RoutingContext ctx) { + if (!shouldHandleMethod(ctx)) { + next(currentClassLoader, ctx); + return; + } String path = resolvePath(ctx); if (isIgnored(path, config.ignoredPathPrefixes)) { next(currentClassLoader, ctx);