Method level only, empty RequestMapping matches "" and "/"

Closes gh-30293
This commit is contained in:
rstoyanchev
2023-06-12 16:09:49 +01:00
parent 3fb98b6a97
commit bbab4faf7a
7 changed files with 53 additions and 15 deletions

View File

@@ -192,7 +192,16 @@ class ServletAnnotationControllerHandlerMethodTests extends AbstractServletHandl
request.setServletPath("");
MockHttpServletResponse response = new MockHttpServletResponse();
getServlet().service(request, response);
assertThat(response.getContentAsString()).isEqualTo("test");
// gh-30293
request = new MockHttpServletRequest("GET", "/");
response = new MockHttpServletResponse();
getServlet().service(request, response);
assertThat(response.getContentAsString()).isEqualTo("test");
}
@PathPatternsParameterizedTest