-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
brotli support in HttpClient #2848
Conversation
@violetagg Please take a look :) |
@sullis I can take a look at the end of the week. Can you verify that when we do not have Brotli in the class path the native-image functionality is still working OK? When we have native-image we need to be careful with reflection and Brotli.isAvailable does reflection. |
I tested this one When there is no One can see
I'm using When I have When I have
|
I'm seeing that
While for example in
|
Interesting. I'll take a closer look this weekend. |
@sullis it will be great if you can rebase so that you can pick up the GraalVM smoke tests change. |
3717140
to
532fd53
Compare
Rebase done. |
@sullis If you want we can proceed with this. We will state that Brotli supports native image only for
|
Sounds good to me! |
reactor-netty-http/src/main/java/reactor/netty/http/client/HttpClientConfig.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/client/HttpClientConfig.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/client/HttpClientConfig.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/client/HttpClientConfig.java
Outdated
Show resolved
Hide resolved
@@ -515,7 +516,13 @@ public final HttpClient baseUrl(String baseUrl) { | |||
* @return a new {@link HttpClient} | |||
*/ | |||
public final HttpClient compress(boolean compressionEnabled) { | |||
configuration().headers.remove(HttpHeaderNames.ACCEPT_ENCODING); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will remove any custom Accept-Encoding
header that was set prior this invocation.
Why do we need to do this? It will be better to preserve the custom headers.
if (brotliEnabled) { | ||
assertThat(Brotli.isAvailable()).isTrue(); | ||
client = client.compress(true); | ||
client.configuration().headers = client.configuration().headers() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need this? The compress
method should add the header.
.response((r, buf) -> buf.asString() | ||
.elementAt(0) | ||
.zipWith(Mono.just(r)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.response((r, buf) -> buf.asString() | |
.elementAt(0) | |
.zipWith(Mono.just(r)))) | |
.responseSingle((r, buf) -> buf.asString().zipWith(Mono.just(r)))) |
532fd53
to
b78270a
Compare
56434f8
to
b0b2878
Compare
b0b2878
to
794e69c
Compare
rebased |
794e69c
to
0b893c4
Compare
reactor-netty-http/src/test/java/reactor/netty/http/HttpCompressionClientServerTests.java
Show resolved
Hide resolved
This change is based on PR #2848
This change is based on PR #2848
This PR is superseded by #3331 |
This change is based on PR #2848
enable Brotli compression support in the Reactor http client.