class Protocol::HTTP::Response
def self.[](status, headers = [], body = nil, protocol = nil)
def self.[](status, headers = [], body = nil, protocol = nil) body = Body::Buffered.wrap(body) self.new(nil, status, nil, 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 >= 400 && status < 600 end
def hijack?
def hijack? false end
def initialize(version = nil, status = 200, reason = nil, headers = [], body = nil, protocol = nil)
def initialize(version = nil, status = 200, reason = nil, headers = [], body = nil, protocol = nil) @version = version @status = status @reason = reason @headers = headers @body = body @protocol = protocol end
def partial?
def partial? status == 206 end
def preserve_method?
def preserve_method? status == 307 || status == 308 end
def redirection?
def redirection? status >= 300 && status < 400 end
def server_failure?
def server_failure? status == 500 end
def success?
def success? status >= 200 && status < 300 end
def to_ary
def to_ary return @status, @headers, @body end
def to_s
def to_s "#{@status} #{@reason} #{@version}" end