class HTTP::Response
def initialize(opts)
(**opts)
-
:uri
(String
) -- used to populate a missing request -
request
(HTTP::Request
) -- The request this is in response to. -
:body
(String
) -- -
:encoding
(String
) -- Encoding to use when reading body -
:connection
(HTTP::Connection
) -- -
:proxy_headers
(Hash
) -- -
:headers
(Hash
) -- -
:version
(String
) -- HTTP version -
:status
(Integer
) -- Status code
def initialize(opts) @version = opts.fetch(:version) @request = init_request(opts) @status = HTTP::Response::Status.new(opts.fetch(:status)) @headers = HTTP::Headers.coerce(opts[:headers] || {}) @proxy_headers = HTTP::Headers.coerce(opts[:proxy_headers] || {}) if opts.include?(:body) @body = opts.fetch(:body) else connection = opts.fetch(:connection) encoding = opts[:encoding] || charset || Encoding::BINARY @body = Response::Body.new(connection, :encoding => encoding) end end