diff --git a/zuul-integration-test/src/test/java/com/netflix/zuul/integration/IntegrationTest.java b/zuul-integration-test/src/test/java/com/netflix/zuul/integration/IntegrationTest.java
index 9297a8d513..920b44efa1 100644
--- a/zuul-integration-test/src/test/java/com/netflix/zuul/integration/IntegrationTest.java
+++ b/zuul-integration-test/src/test/java/com/netflix/zuul/integration/IntegrationTest.java
@@ -19,6 +19,7 @@
import com.aayushatharva.brotli4j.decoder.DecoderJNI;
import com.aayushatharva.brotli4j.decoder.DirectDecompress;
import com.github.tomakehurst.wiremock.client.WireMock;
+import com.github.tomakehurst.wiremock.common.Slf4jNotifier;
import com.github.tomakehurst.wiremock.core.Options;
import com.github.tomakehurst.wiremock.http.Fault;
import com.github.tomakehurst.wiremock.junit5.WireMockExtension;
@@ -102,7 +103,10 @@ class IntegrationTest {
@RegisterExtension
static WireMockExtension wireMockExtension = WireMockExtension.newInstance()
.configureStaticDsl(true)
- .options(wireMockConfig().dynamicPort().useChunkedTransferEncoding(Options.ChunkedEncodingPolicy.ALWAYS))
+ .options(wireMockConfig()
+ .dynamicPort()
+ .useChunkedTransferEncoding(Options.ChunkedEncodingPolicy.ALWAYS)
+ .notifier(new Slf4jNotifier(true)))
.build();
@BeforeAll
@@ -499,6 +503,33 @@ void noCompression() throws Exception {
connection.disconnect();
}
+ @Test
+ void jumboOriginResponseShouldBeChunked() throws Exception {
+ final String expectedResponseBody = TestUtil.JUMBO_RESPONSE_BODY;
+ final WireMock wireMock = wmRuntimeInfo.getWireMock();
+ wireMock.register(get(anyUrl())
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withBody(expectedResponseBody)
+ .withHeader("Content-Type", TestUtil.COMPRESSIBLE_CONTENT_TYPE)));
+
+ URL url = new URL(zuulBaseUri);
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setRequestMethod("GET");
+ connection.setAllowUserInteraction(false);
+ connection.setRequestProperty("Accept-Encoding", ""); // no compression
+ InputStream inputStream = connection.getInputStream();
+ assertEquals(200, connection.getResponseCode());
+ assertEquals("text/plain", connection.getHeaderField("Content-Type"));
+ assertNull(connection.getHeaderField("Content-Encoding"));
+ assertEquals("chunked", connection.getHeaderField("Transfer-Encoding"));
+ byte[] data = IOUtils.toByteArray(inputStream);
+ String text = new String(data, TestUtil.CHARSET);
+ assertEquals(expectedResponseBody, text);
+ inputStream.close();
+ connection.disconnect();
+ }
+
@Test
@EnabledOnOs(value = {OS.LINUX})
void epollIsAvailableOnLinux() {
diff --git a/zuul-integration-test/src/test/java/com/netflix/zuul/integration/server/TestUtil.java b/zuul-integration-test/src/test/java/com/netflix/zuul/integration/server/TestUtil.java
index 728d5a2781..3d1f4fdcf8 100644
--- a/zuul-integration-test/src/test/java/com/netflix/zuul/integration/server/TestUtil.java
+++ b/zuul-integration-test/src/test/java/com/netflix/zuul/integration/server/TestUtil.java
@@ -18,6 +18,7 @@
import com.netflix.appinfo.InstanceInfo;
import com.netflix.niws.loadbalancer.DiscoveryEnabledServer;
+import org.apache.commons.lang3.StringUtils;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
@@ -30,6 +31,7 @@ private TestUtil() {}
public static final String COMPRESSIBLE_CONTENT = "Hello Hello Hello Hello Hello";
public static final String COMPRESSIBLE_CONTENT_TYPE = "text/plain";
+ public static final String JUMBO_RESPONSE_BODY = StringUtils.repeat("abc", 1_000_000);
public static DiscoveryEnabledServer makeDiscoveryEnabledServer(
final String appName, final String ipAddress, final int port) {
diff --git a/zuul-integration-test/src/test/resources/log4j2-test.xml b/zuul-integration-test/src/test/resources/log4j2-test.xml
index 1fcdd99f27..cee1be345a 100644
--- a/zuul-integration-test/src/test/resources/log4j2-test.xml
+++ b/zuul-integration-test/src/test/resources/log4j2-test.xml
@@ -27,6 +27,7 @@
+