Adds path predicate regex test
This commit is contained in:
@@ -88,6 +88,14 @@ public class PathRoutePredicateFactoryTests extends BaseWebClientTests {
|
||||
.valueEquals(ROUTE_ID_HEADER, "path_test");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pathRouteWorksWithRegex() {
|
||||
testClient.get().uri("/regex/123").header(HttpHeaders.HOST, "www.pathregex.org").exchange().expectStatus()
|
||||
.isOk().expectHeader()
|
||||
.valueEquals(HANDLER_MAPPER_HEADER, RoutePredicateHandlerMapping.class.getSimpleName()).expectHeader()
|
||||
.valueEquals(ROUTE_ID_HEADER, "path_regex");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchOptionalTrailingSeparatorCopiedToMatchTrailingSlash() {
|
||||
Config config = new Config().setPatterns(Arrays.asList("patternA", "patternB")).setMatchTrailingSlash(false);
|
||||
|
||||
@@ -262,6 +262,15 @@ spring:
|
||||
filters:
|
||||
- SetPath=/anything/multi{num}
|
||||
|
||||
# =====================================
|
||||
- id: path_regex
|
||||
uri: ${test.uri}
|
||||
predicates:
|
||||
- Host=**.pathregex.org
|
||||
- Path=/regex/{digits:\d+}
|
||||
filters:
|
||||
- SetPath=/anything/{digits}
|
||||
|
||||
# =====================================
|
||||
- id: redirect_to_test
|
||||
uri: ${test.uri}
|
||||
|
||||
Reference in New Issue
Block a user