|
31 | 31 | import org.mockito.junit.jupiter.MockitoExtension; |
32 | 32 | import reactor.core.publisher.Flux; |
33 | 33 |
|
34 | | -import org.springframework.boot.autoconfigure.web.reactive.WebFluxProperties; |
35 | 34 | import org.springframework.cloud.gateway.config.GlobalCorsProperties; |
36 | 35 | import org.springframework.cloud.gateway.event.RefreshRoutesResultEvent; |
37 | 36 | import org.springframework.cloud.gateway.handler.RoutePredicateHandlerMapping; |
@@ -107,10 +106,8 @@ void testOnApplicationEvent_preservesInsertionOrder_withRealRoutes() { |
107 | 106 | globalCorsProperties.getCorsConfigurations().put(GLOBAL_PATH_1, createCorsConfig(ORIGIN_GLOBAL_1)); |
108 | 107 | globalCorsProperties.getCorsConfigurations().put(GLOBAL_PATH_2, createCorsConfig(ORIGIN_GLOBAL_2)); |
109 | 108 |
|
110 | | - WebFluxProperties webFluxProperties = new WebFluxProperties(); |
111 | | - |
112 | | - Route route1 = buildRoute(ROUTE_ID_1, ROUTE_PATH_1, ORIGIN_ROUTE_1, webFluxProperties); |
113 | | - Route route2 = buildRoute(ROUTE_ID_2, ROUTE_PATH_2, ORIGIN_ROUTE_2, webFluxProperties); |
| 109 | + Route route1 = buildRoute(ROUTE_ID_1, ROUTE_PATH_1, ORIGIN_ROUTE_1); |
| 110 | + Route route2 = buildRoute(ROUTE_ID_2, ROUTE_PATH_2, ORIGIN_ROUTE_2); |
114 | 111 |
|
115 | 112 | when(routeLocator.getRoutes()).thenReturn(Flux.just(route1, route2)); |
116 | 113 |
|
@@ -141,12 +138,12 @@ private CorsConfiguration createCorsConfig(String origin) { |
141 | 138 | return config; |
142 | 139 | } |
143 | 140 |
|
144 | | - private Route buildRoute(String id, String path, String allowedOrigin, WebFluxProperties webFluxProperties) { |
| 141 | + private Route buildRoute(String id, String path, String allowedOrigin) { |
145 | 142 |
|
146 | 143 | return Route.async() |
147 | 144 | .id(id) |
148 | 145 | .uri(ROUTE_URI) |
149 | | - .predicate(new PathRoutePredicateFactory(webFluxProperties) |
| 146 | + .predicate(new PathRoutePredicateFactory() |
150 | 147 | .apply(config -> config.setPatterns(List.of(path)))) |
151 | 148 | .metadata(METADATA_KEY, Map.of(ALLOWED_ORIGINS_KEY, List.of(allowedOrigin))) |
152 | 149 | .build(); |
|
0 commit comments