Skip to content

Conversation

@litiliu
Copy link
Contributor

@litiliu litiliu commented May 26, 2025

Purpose of this pull request

close #9362

Does this PR introduce any user-facing change?

How was this patch tested?

UT added

Check list

This comment was marked as outdated.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request fixes an invalid MIME type issue in the HTTP connector by adjusting how the request body is handled. Key changes include making the addBody method static, removing redundant header addition that set a content encoding, and updating the test to ensure that no manual content encoding is set.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
seatunnel-connectors-v2/connector-http/connector-http-base/src/test/java/org/apache/seatunnel/connectors/seatunnel/http/client/HttpClientProviderTest.java Added unit tests to assert headers remain unmodified and content encoding is not set
seatunnel-connectors-v2/connector-http/connector-http-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/http/client/HttpClientProvider.java Made addBody static and removed redundant and potentially problematic header modifications
Comments suppressed due to low confidence (1)

seatunnel-connectors-v2/connector-http/connector-http-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/http/client/HttpClientProvider.java:492

  • Consider adding a comment here explaining that the content encoding is intentionally not set to avoid triggering an invalid MIME type, which will help future maintainers understand the rationale behind this change.
StringEntity entity = new StringEntity(JsonUtils.toJsonString(body), ContentType.APPLICATION_JSON);

Copy link
Contributor

@corgy-w corgy-w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tks! @litiliu

@hailin0 hailin0 merged commit 4d7d765 into apache:dev Jun 20, 2025
7 checks passed
chncaesar pushed a commit to chncaesar/seatunnel that referenced this pull request Jun 30, 2025
dybyte pushed a commit to dybyte/seatunnel that referenced this pull request Jul 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] [Source-Http] Invalid mime type when sending POST requets with json body

3 participants