Add leading slash for path predicate if not present
This commit adds a leading slash for path predicates in both WebFlux.fn and WebMvc.fn. Closes gh-22795
This commit is contained in:
@@ -107,6 +107,9 @@ public abstract class RequestPredicates {
|
||||
*/
|
||||
public static RequestPredicate path(String pattern) {
|
||||
Assert.notNull(pattern, "'pattern' must not be null");
|
||||
if (!pattern.isEmpty() && !pattern.startsWith("/")) {
|
||||
pattern = "/" + pattern;
|
||||
}
|
||||
return pathPredicates(DEFAULT_PATTERN_PARSER).apply(pattern);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user