PathPattern does not use custom separator

Prior to this commit, `PathPattern::extractPathWithinMapping`
would always use the default path pattern separator `/` when extracting
the path within the pattern of a matched route.

This commit ensures that `PathPattern` uses the configured separator
when extracting the path within the matched mapping.

Fixes gh-23168
This commit is contained in:
Brian Clozel
2019-06-20 20:27:22 +02:00
parent 5787fc16fb
commit cc05608ae9
2 changed files with 12 additions and 1 deletions

View File

@@ -707,6 +707,17 @@ public class PathPatternTests {
checkExtractPathWithinPattern("/", "//", "");
}
@Test
public void extractPathWithinPatternCustomSeparator() {
PathPatternParser ppp = new PathPatternParser();
ppp.setSeparator('.');
PathPattern pp = ppp.parse("test.**");
PathContainer pathContainer = PathContainer.parsePath("test.projects..spring-framework", ".");
PathContainer result = pp.extractPathWithinPattern(pathContainer);
assertThat(result.value()).isEqualTo("projects.spring-framework");
assertThat(result.elements()).hasSize(3);
}
@Test
public void extractUriTemplateVariables_spr15264() {
PathPattern pp;