Skip to content

Commit

Permalink
Added module compression-all and correspondent distribution test.
Browse files Browse the repository at this point in the history
Signed-off-by: Simone Bordet <[email protected]>
  • Loading branch information
sbordet committed Dec 15, 2024
1 parent fc23160 commit 50067d7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# DO NOT EDIT THIS FILE - See: https://jetty.org/docs/

[description]
Enables all available compression algorithms in CompressionHandler.

[tags]
server
handler
compression
brotli
gzip
zstandard

[depend]
compression-brotli
compression-gzip
compression-zstandard
Original file line number Diff line number Diff line change
Expand Up @@ -2222,7 +2222,7 @@ public void testLimitHandlers(String env) throws Exception
}

@ParameterizedTest
@ValueSource(strings = {"brotli", "gzip", "zstandard"})
@ValueSource(strings = {"brotli", "gzip", "zstandard", "all"})
public void testCompressionHandler(String compressionName) throws Exception
{
String jettyVersion = System.getProperty("jettyVersion");
Expand All @@ -2235,6 +2235,16 @@ public void testCompressionHandler(String compressionName) throws Exception
case "brotli" -> "br";
case "gzip" -> "gzip";
case "zstandard" -> "zstd";
case "all" -> "br;q=0.5, gzip;q=1, zstd;q=0.1";
default -> throw new IllegalArgumentException();
};

String expected = switch (compressionName)
{
case "brotli" -> "br";
case "gzip" -> "gzip";
case "zstandard" -> "zstd";
case "all" -> "gzip";
default -> throw new IllegalArgumentException();
};

Expand Down Expand Up @@ -2279,7 +2289,7 @@ public void testCompressionHandler(String compressionName) throws Exception
.send();

assertEquals(HttpStatus.OK_200, response.getStatus());
assertThat(contentEncoding.get(), is(encoding));
assertThat(contentEncoding.get(), is(expected));
assertThat(response.getContentAsString(), containsStringIgnoringCase("Hello World"));
}
}
Expand Down

0 comments on commit 50067d7

Please sign in to comment.