Skip to content

Commit

Permalink
Add logging to RequestDeserializeHandler
Browse files Browse the repository at this point in the history
This makes it easier to diagnose cases returned HTTP 415
  • Loading branch information
geoand committed Mar 15, 2023
1 parent 5221dac commit 304d30e
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public void handle(ResteasyReactiveRequestContext requestContext) throws Excepti
try {
effectiveRequestType = MediaType.valueOf((String) requestType);
} catch (Exception e) {
log.debugv("Incorrect media type", e);
throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST).build());
}

Expand All @@ -70,6 +71,7 @@ public void handle(ResteasyReactiveRequestContext requestContext) throws Excepti
}
List<MessageBodyReader<?>> readers = serialisers.findReaders(null, type, effectiveRequestType, RuntimeType.SERVER);
if (readers.isEmpty()) {
log.debugv("No matching MessageBodyReader found for type {0} and media type {1}", type, effectiveRequestType);
throw new NotSupportedException();
}
for (MessageBodyReader<?> reader : readers) {
Expand Down Expand Up @@ -102,6 +104,7 @@ public void handle(ResteasyReactiveRequestContext requestContext) throws Excepti
return;
}
}
log.debugv("No matching MessageBodyReader found for type {0} and media type {1}", type, effectiveRequestType);
throw new NotSupportedException("No supported MessageBodyReader found");
}

Expand Down

0 comments on commit 304d30e

Please sign in to comment.