Polish EndpointRequest.RequestMatcherFactory.antPath()

Closes gh-13775
pull/13815/head
Johnny Lim 6 years ago committed by Madhura Bhave
parent c36804908c
commit 86ccb26c58

@ -297,20 +297,12 @@ public final class EndpointRequest {
}
List<RequestMatcher> antPath(String... parts) {
List<RequestMatcher> matchers = new ArrayList<>();
this.servletPaths.stream().map((p) -> {
if (StringUtils.hasText(p) && !p.equals("/")) {
return p;
}
return "";
}).distinct().forEach((path) -> {
StringBuilder pattern = new StringBuilder(path);
for (String part : parts) {
pattern.append(part);
}
matchers.add(new AntPathRequestMatcher(pattern.toString()));
});
return matchers;
return this.servletPaths.stream()
.map((p) -> (StringUtils.hasText(p) && !p.equals("/") ? p : ""))
.distinct()
.map((path) -> Arrays.stream(parts)
.collect(Collectors.joining("", path, "")))
.map(AntPathRequestMatcher::new).collect(Collectors.toList());
}
}

Loading…
Cancel
Save