aboutsummaryrefslogtreecommitdiffstats
path: root/vespa-feed-client
diff options
context:
space:
mode:
authorJon Marius Venstad <jonmv@users.noreply.github.com>2023-01-09 15:05:47 +0100
committerGitHub <noreply@github.com>2023-01-09 15:05:47 +0100
commitbaf54beef9119768f99d41d950373f742a42df62 (patch)
treed49cf940d500a6dc1cb0e10af2f6a0810050f51f /vespa-feed-client
parentcaca1ab7e615fa628ddb864e72c022e5b22c1951 (diff)
parentc0134657004cff6070defbc668848cb7c1d47f4d (diff)
Merge pull request #25451 from vespa-engine/jonmv/update--cli-args
Update CLI arguments help.tzt for feed client
Diffstat (limited to 'vespa-feed-client')
-rw-r--r--vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/ApacheCluster.java4
-rw-r--r--vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/FeedClientBuilderImpl.java3
-rw-r--r--vespa-feed-client/src/test/java/ai/vespa/feed/client/impl/ApacheClusterTest.java2
3 files changed, 6 insertions, 3 deletions
diff --git a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/ApacheCluster.java b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/ApacheCluster.java
index 639aebf7c46..19f3ccf7a83 100644
--- a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/ApacheCluster.java
+++ b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/ApacheCluster.java
@@ -36,6 +36,8 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.zip.GZIPOutputStream;
+import static ai.vespa.feed.client.FeedClientBuilder.Compression.auto;
+import static ai.vespa.feed.client.FeedClientBuilder.Compression.gzip;
import static org.apache.hc.core5.http.ssl.TlsCiphers.excludeH2Blacklisted;
import static org.apache.hc.core5.http.ssl.TlsCiphers.excludeWeak;
@@ -89,7 +91,7 @@ class ApacheCluster implements Cluster {
wrapped.headers().forEach((name, value) -> request.setHeader(name, value.get()));
if (wrapped.body() != null) {
byte[] body = wrapped.body();
- if (compression == Compression.gzip || compression == null && body.length > 512) {
+ if (compression == gzip || compression == auto && body.length > 512) {
request.setHeader(gzipEncodingHeader);
body = gzipped(body);
}
diff --git a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/FeedClientBuilderImpl.java b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/FeedClientBuilderImpl.java
index b364ba953eb..e5bfffbf24d 100644
--- a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/FeedClientBuilderImpl.java
+++ b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/FeedClientBuilderImpl.java
@@ -21,6 +21,7 @@ import java.util.List;
import java.util.Map;
import java.util.function.Supplier;
+import static ai.vespa.feed.client.FeedClientBuilder.Compression.auto;
import static ai.vespa.feed.client.FeedClientBuilder.Compression.none;
import static java.util.Objects.requireNonNull;
@@ -51,7 +52,7 @@ public class FeedClientBuilderImpl implements FeedClientBuilder {
boolean benchmark = true;
boolean dryrun = false;
boolean speedTest = false;
- Compression compression = null;
+ Compression compression = auto;
URI proxy;
diff --git a/vespa-feed-client/src/test/java/ai/vespa/feed/client/impl/ApacheClusterTest.java b/vespa-feed-client/src/test/java/ai/vespa/feed/client/impl/ApacheClusterTest.java
index 33c043ea271..0c7d94c04ec 100644
--- a/vespa-feed-client/src/test/java/ai/vespa/feed/client/impl/ApacheClusterTest.java
+++ b/vespa-feed-client/src/test/java/ai/vespa/feed/client/impl/ApacheClusterTest.java
@@ -62,7 +62,7 @@ class ApacheClusterTest {
.withHeader("Content-Type", equalTo("application/json; charset=UTF-8"))
.withRequestBody(equalTo("content"));
expected = switch (compression) {
- case none -> expected.withoutHeader("Content-Encoding");
+ case auto, none -> expected.withoutHeader("Content-Encoding");
case gzip -> expected.withHeader("Content-Encoding", equalTo("gzip"));
};
server.verify(1, expected);