OpenFeign / feign

Feign makes writing java http clients easier
Apache License 2.0
9.37k stars 1.91k forks source link

fix: Response.charset does not support RFC 7231 compliant Content-Type headers using quotation marks as application/json; charset="utf-8" #2444

Closed stefanvitz closed 1 month ago

stefanvitz commented 1 month ago

Hi,

when migrating from rest template to feign i noticed that the feign Response object does not determine the charset in an RFC compliant way. As this charset() method is used e.g. by the JacksonDecoder class decoding an response with an RFC compliant Content-Type header like application/json; charset="utf-8" will fail.

See also: https://datatracker.ietf.org/doc/html/rfc7231#section-3.1.1.1

For example, the following examples are all equivalent, but the first is preferred for consistency:

 text/html;charset=utf-8
 text/html;charset=UTF-8
 Text/HTML;Charset="utf-8"
 text/html; charset="utf-8"
stefanvitz commented 1 month ago

thx for the fast processing :)