Sha256: 9d92df38b57f2de6143f2825d0b2a6d01bf19f6f77ae9292013373b20f43f7b2

Contents?: true

Size: 709 Bytes

Versions: 122

Compression:

Stored size: 709 Bytes

Contents

module Puppet::Rest
  # This is a wrapper for the HTTP::Message class of the HTTPClient
  # gem. It is designed to wrap a message sent as an HTTP response.
  class Response
    def initialize(message)
      @message = message
    end

    def body
      @message.body
    end

    def content_type
      @message.content_type
    end

    def content_encoding
      @message.headers['Content-Encoding']
    end

    def status_code
      @message.status
    end

    def ok?
      @message.ok?
    end

    def to_exception
      message = _("Error %{code} on SERVER: %{returned_message}") % { code: status_code, returned_message: body }
      Puppet::Rest::ResponseError.new(message, self)
    end
  end
end

Version data entries

122 entries across 122 versions & 2 rubygems

Version Path
puppet-6.4.5 lib/puppet/rest/response.rb
puppet-6.4.5-x86-mingw32 lib/puppet/rest/response.rb
puppet-6.4.5-x64-mingw32 lib/puppet/rest/response.rb
puppet-6.4.5-universal-darwin lib/puppet/rest/response.rb
puppet-6.10.1 lib/puppet/rest/response.rb
puppet-6.10.1-x86-mingw32 lib/puppet/rest/response.rb
puppet-6.10.1-x64-mingw32 lib/puppet/rest/response.rb
puppet-6.10.1-universal-darwin lib/puppet/rest/response.rb
puppet-6.4.4 lib/puppet/rest/response.rb
puppet-6.4.4-x86-mingw32 lib/puppet/rest/response.rb
puppet-6.4.4-x64-mingw32 lib/puppet/rest/response.rb
puppet-6.4.4-universal-darwin lib/puppet/rest/response.rb
puppet-6.10.0 lib/puppet/rest/response.rb
puppet-6.10.0-x86-mingw32 lib/puppet/rest/response.rb
puppet-6.10.0-x64-mingw32 lib/puppet/rest/response.rb
puppet-6.10.0-universal-darwin lib/puppet/rest/response.rb
puppet-6.9.0 lib/puppet/rest/response.rb
puppet-6.9.0-x86-mingw32 lib/puppet/rest/response.rb
puppet-6.9.0-x64-mingw32 lib/puppet/rest/response.rb
puppet-6.9.0-universal-darwin lib/puppet/rest/response.rb