Merge branch '3.1.x'
This commit is contained in:
@@ -181,7 +181,7 @@ public class NettyRoutingFilter implements GlobalFilter, Ordered {
|
||||
|
||||
exchange.getAttributes().put(CLIENT_RESPONSE_HEADER_NAMES, filteredResponseHeaders.keySet());
|
||||
|
||||
response.getHeaders().putAll(filteredResponseHeaders);
|
||||
response.getHeaders().addAll(filteredResponseHeaders);
|
||||
|
||||
return Mono.just(res);
|
||||
});
|
||||
|
||||
@@ -132,6 +132,16 @@ public class NettyRoutingFilterIntegrationTests extends BaseWebClientTests {
|
||||
testClient.get().uri("/delay/2").exchange().expectStatus().isEqualTo(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHeadersAreClearedOnFallback() {
|
||||
String header = "X-Test-SHOULD-MERGED-HEADER";
|
||||
String gatewayHeaderValue = "value-from-gateway";
|
||||
String upstreamHeaderValue = "value-from-upstream";
|
||||
testClient.post().uri("/responseheaders/200").header("Host", "www.mergeresponseheader.org")
|
||||
.header(header, upstreamHeaderValue).exchange().expectHeader()
|
||||
.valueEquals(header, gatewayHeaderValue, upstreamHeaderValue);
|
||||
}
|
||||
|
||||
@EnableAutoConfiguration
|
||||
@SpringBootConfiguration
|
||||
@Import(DefaultTestConfig.class)
|
||||
|
||||
@@ -60,6 +60,17 @@ spring:
|
||||
metadata:
|
||||
response-timeout: notANumber
|
||||
|
||||
# =====================================
|
||||
- id: per_route_merge_response_headers
|
||||
uri: ${test.uri}
|
||||
predicates:
|
||||
- Host=**.mergeresponseheader.org
|
||||
- Path=/responseheaders/**
|
||||
filters:
|
||||
- AddResponseHeader=X-Test-SHOULD-MERGED-HEADER, value-from-gateway
|
||||
metadata:
|
||||
response-timeout: 1000
|
||||
|
||||
# =====================================
|
||||
# should be last and not follow alphabetical order
|
||||
- id: default_path_to_httpbin
|
||||
|
||||
Reference in New Issue
Block a user