Permalink
Browse files

Merge pull request #557 from onetwopunch/fix-encoding-warning

Fixed assignment warning
  • Loading branch information...
2 parents e375fe0 + 802ab88 commit d7d81999f70cf8dc6b84373c334cc2ff2ec18991 @jnunemaker committed Oct 12, 2017
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/httparty/request.rb
View
@@ -276,8 +276,10 @@ def get_charset
end
def encode_with_ruby_encoding(body, charset)
+ # NOTE: This will raise an argument error if the
+ # charset does not exist
encoding = Encoding.find(charset)
- body.force_encoding(charset)
+ body.force_encoding(encoding.to_s)
rescue ArgumentError
body
end

0 comments on commit d7d8199

Please sign in to comment.