From 483a24f0bfe67d5f013754078a4ce71e58e193ea Mon Sep 17 00:00:00 2001 From: Francesco Nigro Date: Mon, 18 Dec 2023 14:59:56 +0100 Subject: [PATCH] how far without being compliant with the jax-rs spec --- .../server/handlers/ClassRoutingHandler.java | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/handlers/ClassRoutingHandler.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/handlers/ClassRoutingHandler.java index 1b8fdc9b901d7..20270e6db3765 100644 --- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/handlers/ClassRoutingHandler.java +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/handlers/ClassRoutingHandler.java @@ -121,27 +121,7 @@ public void handle(ResteasyReactiveRequestContext requestContext) throws Excepti } // according to the spec we need to return HTTP 406 when Accept header doesn't match what is specified in @Produces if (target.value.getProduces() != null) { - // there could potentially be multiple Accept headers and we need to response with 406 - // if none match the method's @Produces - List accepts = (List) requestContext.getHeader(HttpHeaders.ACCEPT, false); - if (!accepts.isEmpty()) { - boolean hasAtLeastOneMatch = false; - for (int i = 0; i < accepts.size(); i++) { - try { - boolean matches = acceptHeaderMatches(target, accepts.get(i)); - if (matches) { - hasAtLeastOneMatch = true; - break; - } - } catch (IllegalArgumentException ignored) { - // the provided header was not valid - } - } - if (!hasAtLeastOneMatch) { - throw new NotAcceptableException(INVALID_ACCEPT_HEADER_MESSAGE); - } - } - + // cheating: would like to see how far we can go without doing anything here! requestContext.setProducesChecked(true); }