Skip to content

Commit 438004e

Browse files
committed
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
1 parent 7f85322 commit 438004e

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ private HttpServer createHttpServer() {
106106
getSsl(), getSslStoreProvider());
107107
sslServerCustomizer.customize(options);
108108
}
109-
if (getCompression() != null && getCompression().getEnabled()) {
110-
options.compression(getCompression().getMinResponseSize());
109+
if (getCompression() != null) {
110+
options.compression(getCompression().getEnabled());
111111
}
112112
applyCustomizers(options);
113113
}).build();

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -273,19 +273,6 @@ public void compressionOfResponseToPostRequest() throws Exception {
273273
assertResponseIsCompressed(response);
274274
}
275275

276-
@Test
277-
public void noCompressionForSmallResponse() throws Exception {
278-
Assumptions.assumeThat(getFactory())
279-
.isInstanceOf(NettyReactiveWebServerFactory.class);
280-
Compression compression = new Compression();
281-
compression.setEnabled(true);
282-
compression.setMinResponseSize(3001);
283-
WebClient client = prepareCompressionTest(compression);
284-
ResponseEntity<Void> response = client.get().exchange()
285-
.flatMap((res) -> res.toEntity(Void.class)).block();
286-
assertResponseIsNotCompressed(response);
287-
}
288-
289276
@Test
290277
public void noCompressionForMimeType() throws Exception {
291278
Assumptions.assumeThat(getFactory())

0 commit comments

Comments
 (0)