Skip to content

Commit

Permalink
Add check for parsed accept header to not be blank
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianhoelzl-sap committed Feb 5, 2025
1 parent 271bf8c commit c888b63
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ private boolean matchesAcceptHeader(String requestValue, List<String> expectedVa
}

List<MediaType> requestValues = MediaType.parseMediaTypes(requestValue);
if (requestValues.isEmpty()) {
// the "Accept" header is set, but blank -> cannot match any expected value
return false;
}
for (String expectedValue : expectedValues) {
if (MediaType.parseMediaType(expectedValue).includes(requestValues.get(0))) {
return true;
Expand Down

0 comments on commit c888b63

Please sign in to comment.