Skip to content

Commit

Permalink
feat: add test for compress
Browse files Browse the repository at this point in the history
  • Loading branch information
xkx9431 committed Jan 18, 2025
1 parent f6ca445 commit 8bf081c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,31 +81,33 @@ public BaseClient(Configuration conf) {
}

private void applyCodec(Configuration config, Map<String, List<String>> headers) {

List<String> acceptHeader = new ArrayList<>();
switch (config.getContentType()) {
case MSGPACK:
acceptHeader.add("application/msgpack");
break;
case JSON:
acceptHeader.add("application/json");
break;
}
if (config.getContentType() != null) {
List<String> acceptHeader = new ArrayList<>();
switch (config.getContentType()) {
case MSGPACK:
acceptHeader.add("application/msgpack");
break;
case JSON:
acceptHeader.add("application/json");
break;
}
headers.put("Accept", acceptHeader);

List<String> acceptEncodingHeader = new ArrayList<>();
switch (config.getCompressMethod()) {
case GZIP:
acceptEncodingHeader.add("gzip");
break;
case ZSTD:
acceptEncodingHeader.add("zstd");
break;
case SNAPPY:
acceptEncodingHeader.add("snappy");
break;
}
headers.put("Accept-Encoding", acceptEncodingHeader);
if(config.getCompressMethod() != null) {
List<String> acceptEncodingHeader = new ArrayList<>();
switch (config.getCompressMethod()) {
case GZIP:
acceptEncodingHeader.add("gzip");
break;
case ZSTD:
acceptEncodingHeader.add("zstd");
break;
case SNAPPY:
acceptEncodingHeader.add("snappy");
break;
}
headers.put("Accept-Encoding", acceptEncodingHeader);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package io.opengemini.client.impl;

import com.sun.org.apache.bcel.internal.generic.RETURN;
import io.github.openfacade.http.BasicAuthRequestFilter;
import io.github.openfacade.http.HttpClient;
import io.github.openfacade.http.HttpClientConfig;
Expand Down

0 comments on commit 8bf081c

Please sign in to comment.