lib/faraday/adapter/net_http.rb in faraday-net_http-3.0.0 vs lib/faraday/adapter/net_http.rb in faraday-net_http-3.0.1
- old
+ new
@@ -188,11 +188,11 @@
end
end
def encoded_body(http_response)
body = http_response.body || +''
- /\bcharset=\s*(.+?)\s*(;|$)/.match(http_response['Content-Type']) do |match|
- content_charset = ::Encoding.find(match.captures.first)
+ /\bcharset=(.+)/.match(http_response['Content-Type']) do |match|
+ content_charset = ::Encoding.find(match.captures.first.split(';').first.strip)
body = body.dup if body.frozen?
body.force_encoding(content_charset)
rescue ArgumentError
nil
end