Skip to content

Commit

Permalink
fix: Improve media type detection
Browse files Browse the repository at this point in the history
  • Loading branch information
peacekeeper committed Jan 22, 2025
1 parent 42a0141 commit da39833
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,10 @@ public static String dereferenceAcceptForHttpAccepts(List<MediaType> httpAcceptM
*/

private static boolean isContentTypeJson(Result result) {
final MediaType acceptMediaType = MediaType.valueOf("application/json");
return MediaTypeUtil.isMediaTypeAcceptable(acceptMediaType, result.getContentType());
return result.getContentType().contains("+json") || result.getContentType().contains("/json");
}

private static boolean isContentTypeText(Result result) {
final MediaType acceptMediaType = MediaType.valueOf("text/*");
return MediaTypeUtil.isMediaTypeAcceptable(acceptMediaType, result.getContentType());
return result.getContentType().startsWith("text/");
}
}

0 comments on commit da39833

Please sign in to comment.