Skip to content

[Fix][Connector-Http] fix Invalid mime type #9363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from

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

Copilot

This comment was marked as outdated.

Copy link
Contributor

@Copilot 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);

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
1 participant