Skip to content

Send HC4 body unchanged without a Content-Type - #3697

Open
sharanggupta wants to merge 1 commit into
OpenFeign:masterfrom
sharanggupta:httpclient-body-without-content-type
Open

sharanggupta wants to merge 1 commit into
OpenFeign:masterfrom
sharanggupta:httpclient-body-without-content-type

Conversation

@sharanggupta

Copy link
Copy Markdown
Contributor

ApacheHttpClient (HttpClient 4) passes a text body to StringEntity with the request's content type. When the request has no Content-Type header that type is null, and StringEntity encodes the text as ISO-8859-1, so 日本語 àáâ is sent as ??? followed by Latin-1 bytes. The body is now sent as the bytes Feign already encoded, as the other clients do; AbstractClientTest#bodyKeepsRequestCharsetWithoutContentType runs for every client and fails for ApacheHttpClientTest without the change.

`ApacheHttpClient` decoded the request body and passed it to a
`StringEntity` together with the content type. Without a `Content-Type`
header that type is `null`, and `StringEntity` then encodes the text as
ISO-8859-1, so `日本語` was sent as `???`. The body is now sent as the
bytes Feign encoded, as the other clients do.
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