Skip to content

Commit

Permalink
[Fix][Connector-V2] Fix starrocks Content-Length header already prese…
Browse files Browse the repository at this point in the history
…nt error (#7034)
  • Loading branch information
Hisoka-X authored Jun 26, 2024
1 parent c290aac commit a485a74
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.seatunnel.connectors.seatunnel.starrocks.config.SinkConfig;

import org.apache.http.HttpEntity;
import org.apache.http.HttpRequestInterceptor;
import org.apache.http.HttpStatus;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
Expand All @@ -32,6 +33,7 @@
import org.apache.http.impl.client.DefaultRedirectStrategy;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;

import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -127,6 +129,14 @@ public Map<String, Object> doHttpPut(String url, byte[] data, Map<String, String
throws IOException {
final HttpClientBuilder httpClientBuilder =
HttpClients.custom()
.addInterceptorFirst(
(HttpRequestInterceptor)
(request, context) -> {
// fighting org.apache.http.protocol.RequestContent's
// ProtocolException("Content-Length header already
// present");
request.removeHeaders(HTTP.CONTENT_LEN);
})
.setRedirectStrategy(
new DefaultRedirectStrategy() {
@Override
Expand Down

0 comments on commit a485a74

Please sign in to comment.