Copilot commented on code in PR #9497:
URL: https://github.com/apache/seatunnel/pull/9497#discussion_r2165529102
##########
seatunnel-connectors-v2/connector-http/connector-http-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/http/client/HttpClientProvider.java:
##########
@@ -489,6 +489,9 @@ static void addBody(HttpEntityEnclosingRequestBase request,
Map<String, Object>
request.setEntity(new UrlEncodedFormEntity(parameters,
ENCODING));
}
} else {
+ if (!request.containsHeader(HTTP.CONTENT_TYPE)) {
+ request.addHeader(HTTP.CONTENT_TYPE, APPLICATION_JSON);
+ }
Review Comment:
Consider using `request.setHeader(HTTP.CONTENT_TYPE, APPLICATION_JSON)`
instead of checking for an existing header and using `addHeader`. `setHeader`
will override any existing `Content-Type` value in a single step, ensuring
there are no duplicates.
```suggestion
request.setHeader(HTTP.CONTENT_TYPE, APPLICATION_JSON);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]