From 1a3de526dd1f153c7516915f502c08d99d06af2b Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Mon, 23 Apr 2018 15:30:13 -0400 Subject: [PATCH] Returns Mono.error rather than empty to send 500 when hystrix has an error fixes gh-75 --- .../factory/HystrixGatewayFilterFactory.java | 2 +- .../HystrixGatewayFilterFactoryTests.java | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/spring-cloud-gateway-core/src/main/java/org/springframework/cloud/gateway/filter/factory/HystrixGatewayFilterFactory.java b/spring-cloud-gateway-core/src/main/java/org/springframework/cloud/gateway/filter/factory/HystrixGatewayFilterFactory.java index e2a1544b..9b460296 100644 --- a/spring-cloud-gateway-core/src/main/java/org/springframework/cloud/gateway/filter/factory/HystrixGatewayFilterFactory.java +++ b/spring-cloud-gateway-core/src/main/java/org/springframework/cloud/gateway/filter/factory/HystrixGatewayFilterFactory.java @@ -105,7 +105,7 @@ public class HystrixGatewayFilterFactory extends AbstractGatewayFilterFactory f.prefixPath("/httpbin") .hystrix(config -> config.setFallbackUri("forward:/fallbackcontroller2"))) .uri(uri)) + .route("hystrix_connection_failure", r -> r.host("**.hystrixconnectfail.org") + .filters(f -> f.prefixPath("/httpbin") + .hystrix(config -> {})) + .uri("lb:badservice")) .build(); } } + + protected static class TestBadRibbonConfig { + + @LocalServerPort + protected int port = 0; + + @Bean + public ServerList ribbonServerList() { + return new StaticServerList<>(new Server("https", "localhost", this.port)); + } + } }