class PooledCurb::Response
Attributes
body[R]
header_str[R]
status[R]
Public Class Methods
new(status, header_str, body)
click to toggle source
# File lib/pooled_curb.rb, line 88 def initialize(status, header_str, body) @body = body @header_str = header_str @status = status end
Public Instance Methods
failure?()
click to toggle source
# File lib/pooled_curb.rb, line 98 def failure? status >= 400 end
headers()
click to toggle source
# File lib/pooled_curb.rb, line 102 def headers return @headers if @headers headers = @header_str.split("\r\n") headers.shift # Remove HTTP response line ("200 OK") headers = headers.reject { |h| h.nil? || h.empty? }.map { |h| h.split(/:/, 2).map(&:strip) } @headers = Hash[headers] end
success?()
click to toggle source
# File lib/pooled_curb.rb, line 94 def success? status <= 299 end