class Protocol::HTTP::Response
def self.[](status, headers = nil, body = nil, protocol = nil)
def self.[](status, headers = nil, body = nil, protocol = nil) body = Body::Buffered.wrap(body) headers = ::Protocol::HTTP::Headers[headers] self.new(nil, status, headers, body, protocol) end
def self.for_exception(exception)
def self.for_exception(exception) Response[500, Headers['content-type' => 'text/plain'], ["#{exception.class}: #{exception.message}"]] end
def bad_request?
def bad_request? @status == 400 end
def continue?
def continue? @status == 100 end
def failure?
def failure? @status and @status >= 400 && @status < 600 end
def hijack?
def hijack? false end
def initialize(version = nil, status = 200, headers = Headers.new, body = nil, protocol = nil)
def initialize(version = nil, status = 200, headers = Headers.new, body = nil, protocol = nil) @version = version @status = status @headers = headers @body = body @protocol = protocol end
def not_modified?
def not_modified? @status == 304 end
def partial?
def partial? @status == 206 end
def preserve_method?
def preserve_method? @status == 307 || @status == 308 end
def redirection?
def redirection? @status and @status >= 300 && @status < 400 end
def server_failure?
def server_failure? @status == 500 end
def success?
def success? @status and @status >= 200 && @status < 300 end
def to_ary
def to_ary return @status, @headers, @body end
def to_s
def to_s "#{@status} #{@version}" end