Deprecate pathExtension routing predicates

Closes gh-34103
This commit is contained in:
rstoyanchev
2024-12-18 15:43:28 +00:00
parent 62d9600cdd
commit 41a9db376d
16 changed files with 108 additions and 17 deletions

View File

@@ -223,6 +223,7 @@ class RequestPredicatesTests {
assertThat(predicate.test(request)).isFalse();
}
@SuppressWarnings("removal")
@Test
void pathExtension() {
RequestPredicate predicate = RequestPredicates.pathExtension("txt");
@@ -237,6 +238,7 @@ class RequestPredicatesTests {
assertThat(predicate.test(initRequest("GET", "/file"))).isFalse();
}
@SuppressWarnings("removal")
@Test
void pathExtensionPredicate() {
List<String> extensions = List.of("foo", "bar");

View File

@@ -29,7 +29,6 @@ import static org.springframework.web.servlet.function.RequestPredicates.method;
import static org.springframework.web.servlet.function.RequestPredicates.methods;
import static org.springframework.web.servlet.function.RequestPredicates.param;
import static org.springframework.web.servlet.function.RequestPredicates.path;
import static org.springframework.web.servlet.function.RequestPredicates.pathExtension;
import static org.springframework.web.servlet.function.RouterFunctions.route;
/**
@@ -61,6 +60,7 @@ class ToStringVisitorTests {
assertThat(result).isEqualTo(expected);
}
@SuppressWarnings("removal")
@Test
void predicates() {
testPredicate(methods(HttpMethod.GET), "GET");
@@ -68,8 +68,6 @@ class ToStringVisitorTests {
testPredicate(path("/foo"), "/foo");
testPredicate(pathExtension("foo"), "*.foo");
testPredicate(contentType(MediaType.APPLICATION_JSON), "Content-Type: application/json");
ToStringVisitor visitor = new ToStringVisitor();

View File

@@ -192,6 +192,7 @@ class RouterFunctionDslTests {
null
}
}
@Suppress("DEPRECATION")
GET(pathExtension { it == "properties" }) {
ok().body("foo=bar")
}