Browse Source

Fix trailing slash in nested path

This commit adds a trailing slash to the nested path if the request path
also ends with a slash. For instance, given the request "/foo/bar/", and
nested path pattern "/foo/**", we expect the nested path to be “/bar/”,
not “/bar".
pull/1334/head
Arjen Poutsma 9 years ago
parent
commit
7582adc0bc
  1. 3
      spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RequestPredicates.java

3
spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RequestPredicates.java

@ -386,6 +386,9 @@ public abstract class RequestPredicates { @@ -386,6 +386,9 @@ public abstract class RequestPredicates {
if (!subPath.startsWith("/")) {
subPath = "/" + subPath;
}
if (requestPath.endsWith("/") && !subPath.endsWith("/")) {
subPath += "/";
}
return new SubPathServerRequestWrapper(request, subPath);
}

Loading…
Cancel
Save