Skip to content

Add mime type support for text MultiValuePart with configurable multipart mode#4167

Open
filiphr wants to merge 1 commit intoflowable:mainfrom
filiphr:multi-part-mime-type-support
Open

Add mime type support for text MultiValuePart with configurable multipart mode#4167
filiphr wants to merge 1 commit intoflowable:mainfrom
filiphr:multi-part-mime-type-support

Conversation

@filiphr
Copy link
Contributor

@filiphr filiphr commented Feb 13, 2026

Add a fromText(name, value, mimeType) factory method to MultiValuePart so that text parts can specify a custom Content-Type (e.g. application/json).

Both Apache HTTP client implementations now respect the mime type on text parts by passing ContentType to addTextBody when set. The multipart entity builder mode is changed from BROWSER_COMPATIBLE/LEGACY to STRICT so that Content-Type headers are written for all parts including text parts.

For backward compatibility, the multipart mode is configurable via HttpClientConfig.setMultipartMode(). Supported values are STRICT (default), BROWSER_COMPATIBLE, LEGACY, and EXTENDED. The Spring WebClient implementation is unaffected as it already handled mime types for all parts.

…part mode

Add a fromText(name, value, mimeType) factory method to MultiValuePart
so that text parts can specify a custom Content-Type (e.g. application/json).

Both Apache HTTP client implementations now respect the mime type on text
parts by passing ContentType to addTextBody when set. The multipart entity
builder mode is changed from BROWSER_COMPATIBLE/LEGACY to STRICT so that
Content-Type headers are written for all parts including text parts.

For backward compatibility, the multipart mode is configurable via
HttpClientConfig.setMultipartMode(). Supported values are STRICT (default),
BROWSER_COMPATIBLE, LEGACY, and EXTENDED. The Spring WebClient
implementation is unaffected as it already handled mime types for all parts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant