Merge branch '3.5.x' into 4.0.x

This commit is contained in:
Brian Clozel
2026-04-03 10:56:16 +02:00
2 changed files with 12 additions and 1 deletions
@@ -453,7 +453,7 @@ public final class EndpointRequest {
.filter(Objects::nonNull)
.map(this::getEndpointId)
.flatMap((endpointId) -> streamAdditionalPaths(endpoints, endpointId))
.map(PathPatternParserServerWebExchangeMatcher::new)
.map((path) -> new PathPatternParserServerWebExchangeMatcher(path, this.httpMethod))
.collect(Collectors.toCollection(ArrayList::new));
return (!CollectionUtils.isEmpty(delegateMatchers)) ? new OrServerWebExchangeMatcher(delegateMatchers)
: EMPTY_MATCHER;
@@ -311,6 +311,17 @@ class EndpointRequestTests {
assertMatcher.matches("/additional");
}
@Test
void toAdditionalPathsWithHttpMethodShouldRespectRequestMethod() {
ServerWebExchangeMatcher matcher = EndpointRequest
.toAdditionalPaths(WebServerNamespace.SERVER, FooEndpoint.class)
.withHttpMethod(HttpMethod.POST);
RequestMatcherAssert assertMatcher = assertMatcher(matcher, new PathMappedEndpoints("",
() -> List.of(mockEndpoint(EndpointId.of("foo"), "test", WebServerNamespace.SERVER, "/additional"))));
assertMatcher.matches(HttpMethod.POST, "/additional");
assertMatcher.doesNotMatch(HttpMethod.GET, "/additional");
}
@Test
void toAdditionalPathsWithEndpointClassShouldNotMatchOtherPaths() {
ServerWebExchangeMatcher matcher = EndpointRequest.toAdditionalPaths(WebServerNamespace.SERVER,