class HTTP::Response
def caching
-
(HTTP::Response::Caching)
-
def caching Caching.new self end
def charset
-
(String, nil)
-
def charset @charset ||= content_type.charset end
def content_type
-
(HTTP::ContentType)
-
def content_type @content_type ||= ContentType.parse headers["Content-Type"] end
def flush
-
(Response)
-
def flush body.to_s self end
def initialize(status, version, headers, body, uri = nil) # rubocop:disable ParameterLists
def initialize(status, version, headers, body, uri = nil) # rubocop:disable ParameterLists @version, @body, @uri = version, body, uri @status = HTTP::Response::Status.new status @headers = HTTP::Headers.coerce(headers || {}) end
def inspect
def inspect "#<#{self.class}/#{@version} #{code} #{reason} #{headers.to_h.inspect}>" end
def mime_type
-
(String, nil)
-
def mime_type @mime_type ||= content_type.mime_type end
def parse(as = nil)
-
(Object)
-
Raises:
-
(Error)
- if adapter not found
Parameters:
-
as
(#to_s
) -- Parse as given MIME type
def parse(as = nil) MimeType[as || mime_type].decode to_s end
def to_a
-
(Array(Fixnum, Hash, String))
-
def to_a [status.to_i, headers.to_h, body.to_s] end