Fix issue with getHeaders in NoHandlerFoundException

Closes gh-29626
This commit is contained in:
rstoyanchev
2022-12-06 12:18:55 +00:00
parent 752ef6f456
commit 5214bd3093
2 changed files with 25 additions and 4 deletions

View File

@@ -253,7 +253,13 @@ public class ResponseEntityExceptionHandlerTests {
@Test
public void noHandlerFoundException() {
testException(new NoHandlerFoundException("GET", "/resource", HttpHeaders.EMPTY));
HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.setContentType(MediaType.APPLICATION_FORM_URLENCODED); // gh-29626
ResponseEntity<Object> responseEntity =
testException(new NoHandlerFoundException("GET", "/resource", requestHeaders));
assertThat(responseEntity.getHeaders()).isEmpty();
}
@Test