mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Merge branch '7.0.x'
This commit is contained in:
+2
-4
@@ -334,10 +334,8 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
|
||||
logger.trace(exchange.getLogPrefix() + matches.size() + " matching mappings: " + matches);
|
||||
}
|
||||
if (CorsUtils.isPreFlightRequest(exchange.getRequest())) {
|
||||
for (Match match : matches) {
|
||||
if (match.hasCorsConfig()) {
|
||||
return PREFLIGHT_AMBIGUOUS_MATCH;
|
||||
}
|
||||
if (matches.stream().allMatch(Match::hasCorsConfig)) {
|
||||
return PREFLIGHT_AMBIGUOUS_MATCH;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
+1
-1
@@ -149,7 +149,7 @@ public class JettyWebSocketSession extends AbstractWebSocketSession<Session> {
|
||||
if (JettyWebSocketSession.this.handlerCompletionSink != null) {
|
||||
JettyWebSocketSession.this.handlerCompletionSink.tryEmitError(error);
|
||||
}
|
||||
getDelegate().close(StatusCode.SERVER_ERROR, error.getMessage(), Callback.NOOP);
|
||||
getDelegate().close(StatusCode.SERVER_ERROR, null, Callback.NOOP);
|
||||
}
|
||||
|
||||
void onHandleComplete() {
|
||||
|
||||
+8
-3
@@ -131,8 +131,8 @@ class HandlerMethodMappingTests {
|
||||
|
||||
@Test // gh-26490
|
||||
void ambiguousMatchOnPreFlightRequestWithCorsConfig() throws Exception {
|
||||
this.mapping.registerMapping("/f?o", this.handler, this.method1);
|
||||
this.mapping.registerMapping("/fo?", this.handler, this.handler.getClass().getMethod("corsHandlerMethod"));
|
||||
this.mapping.registerMapping("/f?o", this.handler, this.handler.getClass().getMethod("corsHandlerMethod1"));
|
||||
this.mapping.registerMapping("/fo?", this.handler, this.handler.getClass().getMethod("corsHandlerMethod2"));
|
||||
|
||||
MockServerWebExchange exchange = MockServerWebExchange.from(
|
||||
MockServerHttpRequest.options("https://example.org/foo")
|
||||
@@ -256,7 +256,12 @@ class HandlerMethodMappingTests {
|
||||
|
||||
@RequestMapping
|
||||
@CrossOrigin(originPatterns = "*")
|
||||
public void corsHandlerMethod() {
|
||||
public void corsHandlerMethod1() {
|
||||
}
|
||||
|
||||
@RequestMapping
|
||||
@CrossOrigin(originPatterns = "*")
|
||||
public void corsHandlerMethod2() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user