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

Version Path
aws-sdk-core-2.0.14 lib/seahorse/client/http/response.rb
aws-sdk-core-2.0.13 lib/seahorse/client/http/response.rb
aws-sdk-core-2.0.12 lib/seahorse/client/http/response.rb
aws-sdk-core-2.0.11 lib/seahorse/client/http/response.rb
aws-sdk-core-2.0.10 lib/seahorse/client/http/response.rb
aws-sdk-core-2.0.9 lib/seahorse/client/http/response.rb
aws-sdk-core-2.0.8 lib/seahorse/client/http/response.rb
aws-sdk-core-2.0.7 lib/seahorse/client/http/response.rb
aws-sdk-core-2.0.6 lib/seahorse/client/http/response.rb
aws-sdk-core-2.0.5 lib/seahorse/client/http/response.rb
aws-sdk-core-2.0.4 lib/seahorse/client/http/response.rb
aws-sdk-core-2.0.3 lib/seahorse/client/http/response.rb
aws-sdk-core-2.0.2 lib/seahorse/client/http/response.rb
aws-sdk-core-2.0.1 lib/seahorse/client/http/response.rb
aws-sdk-core-2.0.0 lib/seahorse/client/http/response.rb
aws-sdk-core-2.0.0.rc16 lib/seahorse/client/http/response.rb
aws-sdk-core-2.0.0.rc15 lib/seahorse/client/http/response.rb
aws-sdk-core-2.0.0.rc14 lib/seahorse/client/http/response.rb
aws-sdk-core-2.0.0.rc13 vendor/seahorse/lib/seahorse/client/http/response.rb
aws-sdk-core-2.0.0.rc12 vendor/seahorse/lib/seahorse/client/http/response.rb