Sha256: 16a33ce221a49ba8e692bf6bdfa71b5e69f11b9e4203e1ae28b07e406102de8a
Contents?: true
Size: 1.08 KB
Versions: 21
Compression:
Stored size: 1.08 KB
Contents
module Seahorse module Client module Http class Response # @option options [Integer] :status_code (0) # @option options [Headers] :headers (Headers.new) # @option options [IO] :body (StringIO.new) def initialize(options = {}) @status_code = options[:status_code] || 0 @headers = options[:headers] || Headers.new @body = options[:body] || StringIO.new end # @return [Integer] Returns `0` if the request failed to generate # any response. attr_accessor :status_code # @return [Headers] attr_accessor :headers # @return [IO] attr_accessor :body # @param [#read, #size, #rewind] io def body=(io) @body = case io when nil then StringIO.new('') when String then StringIO.new(io) else io end end # @return [String] def body_contents body.rewind contents = body.read body.rewind contents end end end end end
Version data entries
21 entries across 21 versions & 1 rubygems