class Async::HTTP::Response
def self.[](status, headers = {}, body = [])
def self.[](status, headers = {}, body = []) body = Body::Buffered.wrap(body) self.new(nil, status, nil, headers, body) end
def self.for_exception(exception)
def self.for_exception(exception) Async::HTTP::Response[500, {'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 initialize(version = nil, status = 200, reason = nil, headers = [], body = nil)
def initialize(version = nil, status = 200, reason = nil, headers = [], body = nil) @version = version @status = status @reason = reason @headers = headers @body = body end
def preserve_method?
def preserve_method? status == 307 || status == 308 end
def redirection?
def redirection? status >= 300 && status < 400 end
def success?
def success? status >= 200 && status < 300 end
def to_s
def to_s "#{@status} #{@reason} #{@version}" end