diff --git a/vertx-web/src/main/java/io/vertx/ext/web/impl/RouteState.java b/vertx-web/src/main/java/io/vertx/ext/web/impl/RouteState.java index 9221b2ab7c..06acd2b0ef 100644 --- a/vertx-web/src/main/java/io/vertx/ext/web/impl/RouteState.java +++ b/vertx-web/src/main/java/io/vertx/ext/web/impl/RouteState.java @@ -1096,11 +1096,7 @@ public int matches(RoutingContextImplBase context, String mountPoint, boolean fa MIMEHeader contentType = context.parsedHeaders().contentType(); MIMEHeader consumal = contentType.findMatchedBy(consumes); if (consumal == null && !(contentType.rawValue().isEmpty() && emptyBodyPermittedWithConsumes)) { - if (contentType.rawValue().isEmpty()) { - return 400; - } else { - return 415; - } + return 415; } } if (!isEmpty(produces)) { diff --git a/vertx-web/src/test/java/io/vertx/ext/web/RouterTest.java b/vertx-web/src/test/java/io/vertx/ext/web/RouterTest.java index f48a39c8bb..7a4b11247b 100644 --- a/vertx-web/src/test/java/io/vertx/ext/web/RouterTest.java +++ b/vertx-web/src/test/java/io/vertx/ext/web/RouterTest.java @@ -1168,7 +1168,7 @@ public void testConsumesCTParamsIgnored() throws Exception { @Test public void testConsumesNoContentType() throws Exception { router.route().consumes("text/html").handler(rc -> rc.response().end()); - testRequest(HttpMethod.GET, "/foo", HttpResponseStatus.BAD_REQUEST); + testRequest(HttpMethod.GET, "/foo", HttpResponseStatus.UNSUPPORTED_MEDIA_TYPE); } @Test