Method: Patron::Response#inspectable_body

Defined in:
lib/patron/response.rb

#inspectable_bodyString?

Works the same as decoded_body, with one substantial difference: characters which can't be represented in your process' default encoding are going to be replaced with question marks. This can be used for raising errors when you receive responses which indicate errors on the server you are calling. For example, if you expect a binary download, and the server sends you an error message and you don't really want to bother figuring out the encoding it has - but you need to append this response to an error log or similar.

Returns:

  • (String, nil)

See Also:



108
109
110
111
# File 'lib/patron/response.rb', line 108

def inspectable_body
  return unless @body
  @inspectable_body ||= decode_body(false)
end