Empty path should match the "/" PathPattern
This commit makes both slash "/" and empty "" request paths match the "/" `PathPattern`. Issue: SPR-15653
This commit is contained in:
committed by
Brian Clozel
parent
b85764c7db
commit
07b961caa6
@@ -77,6 +77,7 @@ public class PathPatternTests {
|
||||
@Test
|
||||
public void basicMatching() {
|
||||
checkMatches("", "");
|
||||
checkMatches("", "/");
|
||||
checkMatches("", null);
|
||||
checkNoMatch("/abc", "/");
|
||||
checkMatches("/", "/");
|
||||
@@ -1113,9 +1114,13 @@ public class PathPatternTests {
|
||||
result = matchAndExtract("/abc/{var}","/abc/one");
|
||||
assertEquals("one",result.getUriVariables().get("var"));
|
||||
assertNull(result.getMatrixVariables().get("var"));
|
||||
|
||||
result = matchAndExtract("","");
|
||||
assertNotNull(result);
|
||||
result = matchAndExtract("","/");
|
||||
assertNotNull(result);
|
||||
}
|
||||
|
||||
|
||||
private PathPattern.PathMatchInfo matchAndExtract(String pattern, String path) {
|
||||
return parse(pattern).matchAndExtract(PathPatternTests.toPathContainer(path));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user