Method: Patron::Response#body_decodable?

Defined in:
lib/patron/response.rb

#body_decodable?Boolean

Tells whether the response body can be decoded losslessly into the curren internal encoding

Returns:

  • (Boolean)

    true if the body is decodable, false if otherwise



65
66
67
68
69
70
# File 'lib/patron/response.rb', line 65

def body_decodable?
  return true if @body.nil?
  return true if decoded_body
rescue HeaderCharsetInvalid, NonRepresentableBody
  false
end