Skip to content

Commit

Permalink
Use proper exception when media type handling is incorrect
Browse files Browse the repository at this point in the history
This is not only how RESTEasy Classic behaves,
but also the exception that RESTEasy Reactive
itself uses in other places where media type
mapping fails

Fixes: #36798
  • Loading branch information
geoand committed Nov 7, 2023
1 parent 3602de6 commit 84cd0ae
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.List;
import java.util.Map;

import jakarta.ws.rs.NotSupportedException;
import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.MediaType;
Expand Down Expand Up @@ -73,7 +74,7 @@ public void handle(ResteasyReactiveRequestContext requestContext) throws Excepti
selectedHolder = resourcesByConsumes.get(MediaType.WILDCARD_TYPE);
}
if (selectedHolder == null) {
throw new WebApplicationException(Response.status(Response.Status.UNSUPPORTED_MEDIA_TYPE).build());
throw new NotSupportedException("The content-type header value did not match the value in @Consumes");
}
RuntimeResource selectedResource;
if (selectedHolder.mtWithoutParamsToResource.size() == 1) {
Expand Down

0 comments on commit 84cd0ae

Please sign in to comment.