Merge branch '3.1.x'
This commit is contained in:
@@ -45,6 +45,7 @@ import static java.util.Collections.singletonList;
|
||||
import static java.util.Optional.ofNullable;
|
||||
import static org.springframework.cloud.gateway.support.GatewayToStringStyler.filterToStringCreator;
|
||||
import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.CIRCUITBREAKER_EXECUTION_EXCEPTION_ATTR;
|
||||
import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.GATEWAY_PREDICATE_PATH_CONTAINER_ATTR;
|
||||
import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.GATEWAY_REQUEST_URL_ATTR;
|
||||
import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.containsEncodedParts;
|
||||
import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.reset;
|
||||
@@ -123,6 +124,7 @@ public abstract class SpringCloudCircuitBreakerFilterFactory
|
||||
.uri(URI.create(fullFallbackUri)).scheme(null).build(encoded).toUri();
|
||||
|
||||
exchange.getAttributes().put(GATEWAY_REQUEST_URL_ATTR, requestUrl);
|
||||
exchange.getAttributes().remove(GATEWAY_PREDICATE_PATH_CONTAINER_ATTR);
|
||||
addExceptionDetails(t, exchange);
|
||||
|
||||
// Reset the exchange
|
||||
|
||||
@@ -66,6 +66,11 @@ public abstract class SpringCloudCircuitBreakerFilterFactoryTests extends BaseWe
|
||||
.expectStatus().isOk().expectBody()
|
||||
.json("{\"uri\":\"/circuitbreakerUriFallbackController/3/extra/www?a=b\"}");
|
||||
}
|
||||
@Test
|
||||
public void filterFallbackPath() {
|
||||
testClient.get().uri("/status/200").header("Host", "www.circuitbreakerfallbackpath.org").exchange().expectStatus()
|
||||
.isOk().expectBody().jsonPath("$.headers").exists();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void filterWorksJavaDsl() {
|
||||
|
||||
@@ -115,6 +115,19 @@ spring:
|
||||
args:
|
||||
name: fallbackvarscmd
|
||||
fallbackUri: forward:/circuitbreakerUriFallbackController/{segments}/{host}
|
||||
# =====================================
|
||||
- id: circuitbreaker_fallback_test_path
|
||||
uri: ${test.uri}
|
||||
predicates:
|
||||
- Path=/status/**
|
||||
- Host=**.circuitbreakerfallbackpath.org
|
||||
filters:
|
||||
- name: CircuitBreaker
|
||||
args:
|
||||
name: fallbackcmd
|
||||
statusCodes:
|
||||
- 200
|
||||
fallbackUri: forward:/headers
|
||||
|
||||
# =====================================
|
||||
- id: circuitbreaker_fallback_test_statuscode
|
||||
|
||||
Reference in New Issue
Block a user