Method: Patron::Response#initialize

Defined in:
lib/patron/response.rb

#initialize(url, status, redirect_count, raw_header_data, body, default_charset = nil) ⇒ Response

Returns a new instance of Response.



37
38
39
40
41
42
43
44
45
46
# File 'lib/patron/response.rb', line 37

def initialize(url, status, redirect_count, raw_header_data, body, default_charset = nil)
  @url            = url.force_encoding(Encoding::ASCII) # the URL is always an ASCII subset, _always_.
  @status         = status
  @redirect_count = redirect_count
  @body           = body.force_encoding(Encoding::BINARY) if body

  header_data = decode_header_data(raw_header_data)
  parse_headers(header_data)
  @charset = charset_from_content_type
end