Skip to content

Commit

Permalink
Check to see if String object responds to encode before attempting
Browse files Browse the repository at this point in the history
  • Loading branch information
darksheik committed Mar 22, 2013
1 parent 3daffdd commit 252c618
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/maxmind/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def bin=(bin)

def process!
resp = post(query)
Maxmind::Response.new(resp.body.encode("utf-8", "iso-8859-1"), resp.code)
to_send = resp.body.respond_to?("encode") ? resp.body.encode("utf-8", "iso-8859-1") : resp.body
Maxmind::Response.new(to_send, resp.code)
end

def process
Expand Down

0 comments on commit 252c618

Please sign in to comment.