Method level only, empty RequestMapping matches "" and "/"
Closes gh-30293
This commit is contained in:
@@ -61,6 +61,17 @@ class RequestMappingIntegrationTests extends AbstractRequestMappingIntegrationTe
|
||||
}
|
||||
|
||||
|
||||
@ParameterizedHttpServerTest // gh-30293
|
||||
void emptyMapping(HttpServer httpServer) throws Exception {
|
||||
startServer(httpServer);
|
||||
|
||||
String url = "http://localhost:" + this.port;
|
||||
assertThat(getRestTemplate().getForObject(url, String.class)).isEqualTo("root");
|
||||
|
||||
url += "/";
|
||||
assertThat(getRestTemplate().getForObject(url, String.class)).isEqualTo("root");
|
||||
}
|
||||
|
||||
@ParameterizedHttpServerTest
|
||||
void httpHead(HttpServer httpServer) throws Exception {
|
||||
startServer(httpServer);
|
||||
@@ -106,6 +117,11 @@ class RequestMappingIntegrationTests extends AbstractRequestMappingIntegrationTe
|
||||
@SuppressWarnings("unused")
|
||||
private static class TestRestController {
|
||||
|
||||
@GetMapping
|
||||
public String get() {
|
||||
return "root";
|
||||
}
|
||||
|
||||
@GetMapping("/text")
|
||||
public String textGet() {
|
||||
return "Foo";
|
||||
|
||||
Reference in New Issue
Block a user