Commit 438004ef authored by Brian Clozel's avatar Brian Clozel

Simplify HTTP compression support for Reactor Netty

This commit simplifies the HTTP compression configuration for Reactor
Netty servers.

Also, this commit removes a test for the
`server.compression.min-response-size` support, as this is only
supported when the HTTP response contains a `Content-Length` header.
Since most Spring WebFlux responses are using
`Transfer-Encoding: chunked`, we should not test for that case.

See gh-12268
parent 7f85322d
......@@ -106,8 +106,8 @@ public class NettyReactiveWebServerFactory extends AbstractReactiveWebServerFact
getSsl(), getSslStoreProvider());
sslServerCustomizer.customize(options);
}
if (getCompression() != null && getCompression().getEnabled()) {
options.compression(getCompression().getMinResponseSize());
if (getCompression() != null) {
options.compression(getCompression().getEnabled());
}
applyCustomizers(options);
}).build();
......
......@@ -273,19 +273,6 @@ public abstract class AbstractReactiveWebServerFactoryTests {
assertResponseIsCompressed(response);
}
@Test
public void noCompressionForSmallResponse() throws Exception {
Assumptions.assumeThat(getFactory())
.isInstanceOf(NettyReactiveWebServerFactory.class);
Compression compression = new Compression();
compression.setEnabled(true);
compression.setMinResponseSize(3001);
WebClient client = prepareCompressionTest(compression);
ResponseEntity<Void> response = client.get().exchange()
.flatMap((res) -> res.toEntity(Void.class)).block();
assertResponseIsNotCompressed(response);
}
@Test
public void noCompressionForMimeType() throws Exception {
Assumptions.assumeThat(getFactory())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment