mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-05-03 03:43:54 +01:00
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:
+2
-2
@@ -106,8 +106,8 @@ public class NettyReactiveWebServerFactory extends AbstractReactiveWebServerFact
|
|||||||
getSsl(), getSslStoreProvider());
|
getSsl(), getSslStoreProvider());
|
||||||
sslServerCustomizer.customize(options);
|
sslServerCustomizer.customize(options);
|
||||||
}
|
}
|
||||||
if (getCompression() != null && getCompression().getEnabled()) {
|
if (getCompression() != null) {
|
||||||
options.compression(getCompression().getMinResponseSize());
|
options.compression(getCompression().getEnabled());
|
||||||
}
|
}
|
||||||
applyCustomizers(options);
|
applyCustomizers(options);
|
||||||
}).build();
|
}).build();
|
||||||
|
|||||||
-13
@@ -273,19 +273,6 @@ public abstract class AbstractReactiveWebServerFactoryTests {
|
|||||||
assertResponseIsCompressed(response);
|
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
|
@Test
|
||||||
public void noCompressionForMimeType() throws Exception {
|
public void noCompressionForMimeType() throws Exception {
|
||||||
Assumptions.assumeThat(getFactory())
|
Assumptions.assumeThat(getFactory())
|
||||||
|
|||||||
Reference in New Issue
Block a user