class Typhoeus::Response
def headers_hash
def headers_hash headers.split("\n").map {|o| o.strip}.inject({}) do |hash, o| if o.empty? hash else i = o.index(":") || o.size key = o.slice(0, i) value = o.slice(i + 1, o.size) value = value.strip unless value.nil? if hash.has_key? key hash[key] = [hash[key], value].flatten else hash[key] = value end hash end end end
def initialize(params = {})
def initialize(params = {}) @code = params[:code] @headers = params[:headers] @body = params[:body] @time = params[:time] @requested_url = params[:requested_url] @requested_http_method = params[:requested_http_method] @start_time = params[:start_time] @request = params[:request] @effective_url = params[:effective_url] end
def modified?
def modified? @code != 304 end
def success?
def success? @code >= 200 && @code < 300 end