diff --git a/http/jakarta-rest-reactive/src/main/java/io/quarkus/ts/http/jakartarest/reactive/CompressionResource.java b/http/jakarta-rest-reactive/src/main/java/io/quarkus/ts/http/jakartarest/reactive/CompressionResource.java index 60d5d98c5..6c02eb5a9 100644 --- a/http/jakarta-rest-reactive/src/main/java/io/quarkus/ts/http/jakartarest/reactive/CompressionResource.java +++ b/http/jakarta-rest-reactive/src/main/java/io/quarkus/ts/http/jakartarest/reactive/CompressionResource.java @@ -81,8 +81,16 @@ public Uni smallCompressionCustomType() { @GET @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @Path("/small/default_no_compression_json") - public Uni defaultNoCompressionJson() { + @Path("/small/default_compression_json") + public Uni defaultCompressionJson() { + return defaultSmallResponse(); + } + + @GET + @Consumes(MediaType.APPLICATION_XHTML_XML) + @Produces(MediaType.APPLICATION_XHTML_XML) + @Path("/small/default_compression_xhtml_xml") + public Uni defaultCompressionXhtmlXml() { return defaultSmallResponse(); } @@ -103,8 +111,8 @@ public Uni defaultNoCompressionFormData() { } @GET - @Consumes({ MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN }) - @Produces({ MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN }) + @Consumes({ MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN }) + @Produces({ MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN }) @Path("/small/mixing_types") public Uni mixingContentTypes() { return defaultSmallResponse(); diff --git a/http/jakarta-rest-reactive/src/test/java/io/quarkus/ts/http/jakartarest/reactive/CompressionHandlerIT.java b/http/jakarta-rest-reactive/src/test/java/io/quarkus/ts/http/jakartarest/reactive/CompressionHandlerIT.java index 0f704de7f..cc22d325c 100644 --- a/http/jakarta-rest-reactive/src/test/java/io/quarkus/ts/http/jakartarest/reactive/CompressionHandlerIT.java +++ b/http/jakarta-rest-reactive/src/test/java/io/quarkus/ts/http/jakartarest/reactive/CompressionHandlerIT.java @@ -29,12 +29,13 @@ public class CompressionHandlerIT { BASE_PATH + "/default_compression_text_plain", MediaType.TEXT_PLAIN, BASE_PATH + "/default_compression_text_html", MediaType.TEXT_HTML, BASE_PATH + "/default_compression_text_xml", MediaType.TEXT_XML, + BASE_PATH + "/default_compression_json", MediaType.APPLICATION_JSON, + BASE_PATH + "/default_compression_xhtml_xml", MediaType.APPLICATION_XHTML_XML, BASE_PATH + "/default_compression_text_css", "text/css", BASE_PATH + "/default_compression_text_js", "text/javascript", BASE_PATH + "/default_compression_app_js", "application/javascript"); private static final Map DEFAULT_SMALL_NO_GZIP_ENDPOINTS = Map.of( - BASE_PATH + "/default_no_compression_json", MediaType.APPLICATION_JSON, BASE_PATH + "/default_no_compression_xml", MediaType.APPLICATION_XML, BASE_PATH + "/default_no_compression_form_data", MediaType.MULTIPART_FORM_DATA); @@ -64,7 +65,7 @@ public void forceNoCompression() { @Test public void mixingTypes() { - assertUnCompressed(BASE_PATH + "/mixing_types", MediaType.APPLICATION_JSON); + assertUnCompressed(BASE_PATH + "/mixing_types", MediaType.APPLICATION_XML); assertUnCompressed(BASE_PATH + "/mixing_types", MediaType.TEXT_PLAIN); } diff --git a/http/reactive-routes/src/main/java/io/quarkus/ts/http/reactiveroutes/CompressionHandler.java b/http/reactive-routes/src/main/java/io/quarkus/ts/http/reactiveroutes/CompressionHandler.java index 6e1ba8a1f..91f4891c1 100644 --- a/http/reactive-routes/src/main/java/io/quarkus/ts/http/reactiveroutes/CompressionHandler.java +++ b/http/reactive-routes/src/main/java/io/quarkus/ts/http/reactiveroutes/CompressionHandler.java @@ -56,9 +56,15 @@ public void smallCompressionCustomType(RoutingContext rc) { defaultSmallResponse(rc); } - @Route(path = "/default_no_compression_json", consumes = { MediaType.APPLICATION_JSON }, produces = { + @Route(path = "/default_compression_json", consumes = { MediaType.APPLICATION_JSON }, produces = { MediaType.APPLICATION_JSON }) - public void defaultNoCompressionJson(RoutingContext rc) { + public void defaultCompressionJson(RoutingContext rc) { + defaultSmallResponse(rc); + } + + @Route(path = "/default_compression_xhtml_xml", consumes = { MediaType.APPLICATION_XHTML_XML }, produces = { + MediaType.APPLICATION_XHTML_XML }) + public void defaultCompressionXhtmlXml(RoutingContext rc) { defaultSmallResponse(rc); } @@ -74,8 +80,8 @@ public void defaultNoCompressionFormData(RoutingContext rc) { defaultSmallResponse(rc); } - @Route(path = "/mixing_types", consumes = { MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN }, produces = { - MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN }) + @Route(path = "/mixing_types", consumes = { MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN }, produces = { + MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN }) public void mixingContentTypes(RoutingContext rc) { defaultSmallResponse(rc); } diff --git a/http/reactive-routes/src/test/java/io/quarkus/ts/http/reactiveroutes/CompressionHandlerIT.java b/http/reactive-routes/src/test/java/io/quarkus/ts/http/reactiveroutes/CompressionHandlerIT.java index 086afef29..b3a9382e9 100644 --- a/http/reactive-routes/src/test/java/io/quarkus/ts/http/reactiveroutes/CompressionHandlerIT.java +++ b/http/reactive-routes/src/test/java/io/quarkus/ts/http/reactiveroutes/CompressionHandlerIT.java @@ -37,12 +37,13 @@ public class CompressionHandlerIT { BASE_PATH + "/default_compression_text_plain", MediaType.TEXT_PLAIN, BASE_PATH + "/default_compression_text_html", MediaType.TEXT_HTML, BASE_PATH + "/default_compression_text_xml", MediaType.TEXT_XML, + BASE_PATH + "/default_compression_json", MediaType.APPLICATION_JSON, + BASE_PATH + "/default_compression_xhtml_xml", MediaType.APPLICATION_XHTML_XML, BASE_PATH + "/default_compression_text_css", "text/css", BASE_PATH + "/default_compression_text_js", "text/javascript", BASE_PATH + "/default_compression_app_js", "application/javascript"); private static final Map DEFAULT_SMALL_NO_GZIP_ENDPOINTS = Map.of( - BASE_PATH + "/default_no_compression_json", MediaType.APPLICATION_JSON, BASE_PATH + "/default_no_compression_xml", MediaType.APPLICATION_XML, BASE_PATH + "/default_no_compression_form_data", MediaType.MULTIPART_FORM_DATA); @@ -77,7 +78,7 @@ public void forceNoCompression() { @Test public void mixingTypes() { - assertUnCompressed(BASE_PATH + "/mixing_types", MediaType.APPLICATION_JSON); + assertUnCompressed(BASE_PATH + "/mixing_types", MediaType.APPLICATION_XML); assertUnCompressed(BASE_PATH + "/mixing_types", MediaType.TEXT_PLAIN); }