diff --git a/server/src/main/java/org/elasticsearch/rest/DeprecationRestHandler.java b/server/src/main/java/org/elasticsearch/rest/DeprecationRestHandler.java index 1a78a4c8c0452..2408f83d2b54e 100644 --- a/server/src/main/java/org/elasticsearch/rest/DeprecationRestHandler.java +++ b/server/src/main/java/org/elasticsearch/rest/DeprecationRestHandler.java @@ -62,6 +62,11 @@ public void handleRequest(RestRequest request, RestChannel channel, NodeClient c handler.handleRequest(request, channel, client); } + @Override + public boolean supportsContentStream() { + return handler.supportsContentStream(); + } + /** * This does a very basic pass at validating that a header's value contains only expected characters according to RFC-5987, and those * that it references. diff --git a/server/src/test/java/org/elasticsearch/rest/DeprecationRestHandlerTests.java b/server/src/test/java/org/elasticsearch/rest/DeprecationRestHandlerTests.java index 0a8ace71d8860..efe7b708ca380 100644 --- a/server/src/test/java/org/elasticsearch/rest/DeprecationRestHandlerTests.java +++ b/server/src/test/java/org/elasticsearch/rest/DeprecationRestHandlerTests.java @@ -28,6 +28,7 @@ import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; /** * Tests {@link DeprecationRestHandler}. @@ -114,6 +115,13 @@ public void testInvalidHeaderValueEmpty() { expectThrows(IllegalArgumentException.class, () -> DeprecationRestHandler.requireValidHeader(blank)); } + public void testSupportsContentStream() { + DeprecationRestHandler deprecationRestHandler = new DeprecationRestHandler(handler, deprecationMessage, deprecationLogger); + when(handler.supportsContentStream()).thenReturn(true).thenReturn(false); + assertTrue(deprecationRestHandler.supportsContentStream()); + assertFalse(deprecationRestHandler.supportsContentStream()); + } + /** * {@code ASCIIHeaderGenerator} only uses characters expected to be valid in headers (simplified US-ASCII). */