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
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user