Consistent fallback to NoUpgradeStrategyWebSocketService
Closes gh-33970
This commit is contained in:
@@ -485,9 +485,9 @@ public class WebFluxConfigurationSupport implements ApplicationContextAware {
|
||||
try {
|
||||
service = new HandshakeWebSocketService();
|
||||
}
|
||||
catch (IllegalStateException ex) {
|
||||
catch (Throwable ex) {
|
||||
// Don't fail, test environment perhaps
|
||||
service = new NoUpgradeStrategyWebSocketService();
|
||||
service = new NoUpgradeStrategyWebSocketService(ex);
|
||||
}
|
||||
}
|
||||
return service;
|
||||
@@ -608,9 +608,15 @@ public class WebFluxConfigurationSupport implements ApplicationContextAware {
|
||||
|
||||
private static final class NoUpgradeStrategyWebSocketService implements WebSocketService {
|
||||
|
||||
private final Throwable ex;
|
||||
|
||||
public NoUpgradeStrategyWebSocketService(Throwable ex) {
|
||||
this.ex = ex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Void> handleRequest(ServerWebExchange exchange, WebSocketHandler webSocketHandler) {
|
||||
return Mono.error(new IllegalStateException("No suitable RequestUpgradeStrategy"));
|
||||
return Mono.error(new IllegalStateException("No suitable RequestUpgradeStrategy", this.ex));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user