Adds path predicate regex test

This commit is contained in:
spencergibb
2022-02-09 11:57:39 -05:00
parent b54167d634
commit e47e5fc20d
2 changed files with 17 additions and 0 deletions

View File

@@ -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);

View File

@@ -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}