formatting

This commit is contained in:
spencergibb
2021-05-24 11:14:34 -04:00
parent 0fd5cef6c8
commit adc1969bc8
2 changed files with 12 additions and 11 deletions

View File

@@ -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);

View File

@@ -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();
}
}