hanicz commented on code in PR #1143:
URL: https://github.com/apache/knox/pull/1143#discussion_r2763890590
##########
gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteResponseTest.java:
##########
@@ -165,6 +165,33 @@ public void testStreamResponse() throws IOException {
testStreamResponse(content, rewriteResponse, "deflate");
}
+ @Test
+ public void testStreamEmptyGzipResponse() throws IOException {
Review Comment:
You can just add the below to make sure the filter is there.
```
HttpServletRequest request =
EasyMock.createNiceMock(HttpServletRequest.class);
EasyMock.expect(request.getContentType()).andReturn("application/json").anyTimes();
HttpServletResponse response =
EasyMock.createNiceMock(HttpServletResponse.class);
EasyMock.expect(response.getContentType()).andReturn("application/json").anyTimes();
```
However it won't fix the test case. You provide the `gzip` contentType to
testStreamResponse method which will create the GZIPOutputStream so it will
walk into the isGzip case. You have to make sure also that the
`contentEncoding` in UrlRewriteResponse class is set to `gzip`. You should
write a test case that fails without your modification first and go from there.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]