From bff54788e825a05f4ea617544888c56436c54281 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Fri, 1 Sep 2017 23:11:04 +0200 Subject: [PATCH] Enable HTTP compression Reactor ClientHttpConnector `ReactorClientHttpConnector` provides an adapter layer to `WebClient` for using Reactor-Netty's `HttpClient`. This commit enables HTTP compression support by default for this client Connector. Another constructor is still available for providing a custom `HttpOptions` configuration. Issue: SPR-15908 --- .../http/client/reactive/ReactorClientHttpConnector.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spring-web/src/main/java/org/springframework/http/client/reactive/ReactorClientHttpConnector.java b/spring-web/src/main/java/org/springframework/http/client/reactive/ReactorClientHttpConnector.java index c1fc17f84c..ad3f8c0b1c 100644 --- a/spring-web/src/main/java/org/springframework/http/client/reactive/ReactorClientHttpConnector.java +++ b/spring-web/src/main/java/org/springframework/http/client/reactive/ReactorClientHttpConnector.java @@ -48,11 +48,13 @@ public class ReactorClientHttpConnector implements ClientHttpConnector { /** - * Create a Reactor Netty {@link ClientHttpConnector} with default {@link ClientOptions} - * and SSL support enabled. + * Create a Reactor Netty {@link ClientHttpConnector} + * with default {@link ClientOptions} and HTTP compression support enabled. */ public ReactorClientHttpConnector() { - this.httpClient = HttpClient.create(); + this.httpClient = HttpClient.builder() + .options(options -> options.compression(true)) + .build(); } /**