From 2ce77702c8c26775f6c660407b5b349f58ff2723 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 | 7 +++++++ .../java/io/quarkiverse/quinoa/QuinoaDevProxyHandler.java | 5 +++++ 2 files changed, 12 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..c5edb2ab 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,5 +1,6 @@ package io.quarkiverse.quinoa.test.devmode; +import static io.restassured.RestAssured.given; import static org.hamcrest.Matchers.is; import org.hamcrest.Matchers; @@ -9,6 +10,7 @@ import io.quarkus.test.QuarkusDevModeTest; import io.restassured.RestAssured; +import io.restassured.http.ContentType; public class ForwardedDevModeTest { @RegisterExtension @@ -27,5 +29,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);