formatting
This commit is contained in:
@@ -108,8 +108,8 @@ public class NettyRoutingFilter implements GlobalFilter, Ordered {
|
||||
URI requestUrl = exchange.getRequiredAttribute(GATEWAY_REQUEST_URL_ATTR);
|
||||
|
||||
String scheme = requestUrl.getScheme();
|
||||
if (isAlreadyRouted(exchange)
|
||||
|| (!"http".equalsIgnoreCase(scheme) && !"https".equalsIgnoreCase(scheme))) {
|
||||
if (isAlreadyRouted(exchange) || (!"http".equalsIgnoreCase(scheme)
|
||||
&& !"https".equalsIgnoreCase(scheme))) {
|
||||
return chain.filter(exchange);
|
||||
}
|
||||
setAlreadyRouted(exchange);
|
||||
|
||||
@@ -66,8 +66,11 @@ public class NettyRoutingFilterTests extends BaseWebClientTests {
|
||||
|
||||
@Test // gh-2207
|
||||
public void testCaseInsensitiveScheme() {
|
||||
DisposableServer server = HttpServer.create().port(port).host("127.0.0.1").route(
|
||||
routes -> routes.get("/issue", (request, response) -> response.sendString(Mono.just("issue2207"))))
|
||||
DisposableServer server = HttpServer
|
||||
.create().port(port).host(
|
||||
"127.0.0.1")
|
||||
.route(routes -> routes.get("/issue", (request, response) -> response
|
||||
.sendString(Mono.just("issue2207"))))
|
||||
.bindNow();
|
||||
|
||||
try {
|
||||
@@ -75,7 +78,8 @@ public class NettyRoutingFilterTests extends BaseWebClientTests {
|
||||
.consumeWith(entityExchangeResult -> {
|
||||
Assert.assertNotNull(entityExchangeResult);
|
||||
Assert.assertNotNull(entityExchangeResult.getResponseBody());
|
||||
String content = new String(entityExchangeResult.getResponseBody());
|
||||
String content = new String(
|
||||
entityExchangeResult.getResponseBody());
|
||||
Assert.assertEquals("issue2207", content);
|
||||
});
|
||||
}
|
||||
@@ -91,12 +95,9 @@ public class NettyRoutingFilterTests extends BaseWebClientTests {
|
||||
|
||||
@Bean
|
||||
public RouteLocator routes(RouteLocatorBuilder builder) {
|
||||
return builder.routes()
|
||||
.route(p -> p.path("/mockexample")
|
||||
.filters(f -> f.prefixPath("/httpbin"))
|
||||
.uri("http://example.com"))
|
||||
.route(p -> p.path("/issue").uri("HTTP://127.0.0.1:" + port))
|
||||
.build();
|
||||
return builder.routes().route(p -> p.path("/mockexample")
|
||||
.filters(f -> f.prefixPath("/httpbin")).uri("http://example.com"))
|
||||
.route(p -> p.path("/issue").uri("HTTP://127.0.0.1:" + port)).build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user